Fully compatible with the OpenAI API format — just change base_url and you're ready to go.
Already using the OpenAI SDK? Switch to itapi.ai with one line of code.
Before (OpenAI)
client = OpenAI(
api_key="sk-...",
# default base_url
)After (itapi.ai)
client = OpenAI(
api_key="it_...",
base_url="https://www.itapi.ai/v1"
)base_url to https://www.itapi.ai/v1All API requests require an API key passed in the Authorization header using the Bearer scheme. Keys are prefixed with it_.
Create and manage your API keys from the dashboard.
ITAPI_KEY) in production.All endpoints are served under this base path:
All examples use the standard OpenAI SDK. No custom libraries required — just point the client at itapi.ai.
from openai import OpenAI
client = OpenAI(
base_url="https://www.itapi.ai/v1",
api_key="it_your_api_key_here"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
]
)
print(response.choices[0].message.content)import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://www.itapi.ai/v1',
apiKey: 'it_your_api_key_here'
})
const response = await client.chat.completions.create({
model: 'claude-3-5-sonnet-20241022',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Explain quantum computing in simple terms.' }
]
})
console.log(response.choices[0].message.content)curl https://www.itapi.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer it_your_api_key_here" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
],
"temperature": 0.7,
"max_tokens": 512
}'package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("it_your_api_key_here"),
option.WithBaseURL("https://www.itapi.ai/v1"),
)
completion, err := client.Chat.Completions.New(
context.Background(),
openai.ChatCompletionNewParams{
Model: openai.F("gpt-4o"),
Messages: openai.F([]openai.ChatCompletionMessageParamUnion{
openai.SystemMessage("You are a helpful assistant."),
openai.UserMessage("Explain quantum computing in simple terms."),
}),
},
)
if err != nil {
panic(err)
}
fmt.Println(completion.Choices[0].Message.Content)
}Enable Server-Sent Events (SSE) streaming by setting stream: true. Streamed chunks follow the standard OpenAI delta format.
from openai import OpenAI
client = OpenAI(
base_url="https://www.itapi.ai/v1",
api_key="it_your_api_key_here"
)
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Tell me a short story."}],
stream=True
)
for chunk in stream:
content = chunk.choices[0].delta.content
if content:
print(content, end="", flush=True)
print() # final newlineimport OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://www.itapi.ai/v1',
apiKey: 'it_your_api_key_here'
})
const stream = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Tell me a short story.' }],
stream: true
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '')
}
console.log()curl https://www.itapi.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer it_your_api_key_here" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Tell me a short story."}
],
"stream": true
}'/v1/chat/completionsCreates a model response for a given chat conversation. Follows the OpenAI Chat Completions specification.
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID to use. Examples: gpt-4o, gpt-4o-mini, claude-3-5-sonnet-20241022, claude-3-opus-20240229, deepseek-chat, gemini-2.0-flash. See the Models page for the full list. |
| messages | array | Yes | Array of message objects, each with role (system | user | assistant | function | tool) and content (string or array of content parts). |
| stream | boolean | No | When true, responses are streamed as Server-Sent Events (SSE). Defaults to false. |
| temperature | number | No | Sampling temperature between 0 and 2. Higher values produce more random outputs. Default varies by model. |
| max_tokens | integer | No | Maximum number of tokens to generate in the completion. Useful for controlling cost and response length. |
| top_p | number | No | Nucleus sampling parameter between 0 and 1. Only tokens with cumulative probability ≥ top_p are considered. Default is 1. |
| frequency_penalty | number | No | Penalizes repeated tokens. Values range from -2.0 to 2.0. Positive values reduce repetition. |
| presence_penalty | number | No | Penalizes tokens that have already appeared. Values range from -2.0 to 2.0. Positive values encourage new topics. |
| stop | string | array | No | Up to 4 sequences where the API will stop generating further tokens. |
| n | integer | No | Number of completion choices to generate for each input message. Default is 1. |
| seed | integer | No | If specified, the system attempts to produce deterministic results. Useful for testing and reproducibility. |
| user | string | No | Unique identifier for your end-user. Helps with monitoring and abuse detection. |
| tools | array | No | List of tool/function definitions the model may call. Follows the OpenAI function-calling schema. |
| tool_choice | string | object | No | Controls how the model calls tools. Can be 'none', 'auto', 'required', or a specific tool object. |
| response_format | object | No | Specifies the output format. Use { type: 'json_object' } for JSON mode (must include 'json' in your prompt). |
| logprobs | boolean | No | Whether to return log probabilities of the output tokens. Default is false. |
| top_logprobs | integer | No | Number of most likely tokens to return at each position when logprobs is true. Integer between 0 and 20. |
{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 1024,
"top_p": 1,
"stream": false
}{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1700000000,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 9,
"total_tokens": 34
}
}| Tier | Requests / Minute | Tokens / Minute |
|---|---|---|
| Free | 10 | 20,000 |
| Starter | 60 | 100,000 |
| Pro | 300 | 500,000 |
| Enterprise | Custom | Custom |
Rate-limit headers (x-ratelimit-*) are included in every response. Need higher limits? Contact us.
Errors follow the OpenAI error format with an error object containing message, type, and code fields.
| HTTP Status | Code | Description |
|---|---|---|
| 400 | invalid_request_error | Malformed request body, missing required fields, or invalid parameter values. |
| 401 | authentication_error | Invalid or missing API key. Check your Authorization header and ensure the key is active. |
| 402 | insufficient_quota | Your account has run out of credits or hit your usage limit. Top up from the dashboard. |
| 429 | rate_limit_exceeded | Too many requests. Wait before retrying — check the Retry-After header for the backoff time. |
| 500 | api_error | Unexpected server error. Itapi.ai engineers are automatically notified. Retry with exponential backoff. |
| 503 | server_overloaded | The service is temporarily overloaded. Retry after a short delay. |