Skip to main content

Overview

The Chat API is the core endpoint for conversational AI, content generation, and text completion. It provides access to powerful language models with streaming responses for real-time interactions.
This reference includes all request/response schemas, parameters, and interactive examples you can test directly.

Base URL

Authentication

All API requests require authentication using your API key:

Endpoints

POST /chat

Send messages to AI models and receive streaming responses

Quick Example

Here’s a simple example to get you started:

Common Patterns

System Messages

Use system messages to set the AI’s behavior and context:

Multi-turn Conversations

Include conversation history for context:

Content Generation

Structure prompts for specific content types:

Error Handling

All errors return a consistent format:
Common HTTP status codes:
Invalid request format or missing required fields.Example:
Invalid or missing API key.Example:
Token limit exceeded or insufficient permissions.Example:
Rate limit exceeded.Example:
Server-side error occurred.Example:

Rate Limits

Token-based Limits

Usage measured in tokens (input + output)

Request Rate

No hard limits, but monitored for abuse

Workspace Quotas

Monthly token limits per workspace

Concurrent Requests

Multiple simultaneous requests supported
For detailed rate limit information, see the Rate Limits guide.

Best Practices

Request Optimization

  • Be specific and clear in your instructions
  • Use system messages to set context once
  • Keep conversation history relevant and concise
  • Trim old messages to stay within token limits
  • Keep only relevant context for the current task
  • Use consistent message formatting
  • Always check response status codes
  • Implement retry logic for transient errors
  • Provide user-friendly error messages

SDK Libraries

JavaScript/TypeScript

Official and community libraries for Node.js and browsers

Python

Async and sync clients with full type support

Go

Community-maintained Go client library
Official SDKs are coming soon! For now, use the examples in our code examples section.

Testing Tools

API Testing

Use tools like Postman, Insomnia, or curl for testing:

Load Testing

For production readiness testing:

Support

Documentation

Comprehensive guides and examples

Community

Join discussions with other developers

Support

Contact support through your workspace

Status Page

Monitor API status and uptime

Next Steps

POST /chat Endpoint

Detailed documentation for the chat endpoint with all parameters

Code Examples

Complete implementation examples in multiple languages

Rate Limits

Understanding usage limits and optimization strategies

Error Handling

Comprehensive error handling guide and patterns