Integrate with the Avian LLM inference API. OpenAI-compatible endpoints, simple authentication, and streaming support.
The Avian API is fully OpenAI-compatible. Switch your base URL and start making requests.
curl https://api.avian.io/v1/chat/completions \ -H "Authorization: Bearer avian-YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek/deepseek-v3.2", "messages": [ {"role": "user", "content": "Hello, world!"} ] }'
from openai import OpenAI client = OpenAI( base_url="https://api.avian.io/v1", api_key="avian-YOUR_API_KEY", ) response = client.chat.completions.create( model="deepseek/deepseek-v3.2", messages=[ {"role": "user", "content": "Hello, world!"} ], ) print(response.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.avian.io/v1", apiKey: "avian-YOUR_API_KEY", }); const response = await client.chat.completions.create({ model: "deepseek/deepseek-v3.2", messages: [ { role: "user", content: "Hello, world!" }, ], }); console.log(response.choices[0].message.content);
All API requests require a valid API key passed in the Authorization header.
All API endpoints are served from a single base URL.
https://api.avian.io/v1
Pass your API key as a Bearer token in the Authorization header.
Authorization: Bearer avian-...
All models are available through the same endpoint. Specify the model ID in your request body.
POST /v1/chat/completions
Creates a chat completion. Send a list of messages and receive a model-generated response.
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1709000000,
"model": "deepseek/deepseek-v3.2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 9,
"total_tokens": 21
}
}
Define tools that the model can invoke. The model will return a tool_calls array when it decides a function should be called.
from openai import OpenAI client = OpenAI( base_url="https://api.avian.io/v1", api_key="avian-YOUR_API_KEY", ) tools = [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "City name, e.g. San Francisco", } }, "required": ["location"], }, }, } ] response = client.chat.completions.create( model="deepseek/deepseek-v3.2", messages=[{"role": "user", "content": "What's the weather in London?"}], tools=tools, ) # The model may return tool_calls in the response tool_calls = response.choices[0].message.tool_calls
Set stream: true to receive partial responses as server-sent events (SSE). Tokens are delivered incrementally as they are generated.
from openai import OpenAI client = OpenAI( base_url="https://api.avian.io/v1", api_key="avian-YOUR_API_KEY", ) stream = client.chat.completions.create( model="deepseek/deepseek-v3.2", messages=[{"role": "user", "content": "Explain quantum computing"}], stream=True, ) for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")
curl https://api.avian.io/v1/chat/completions \ -H "Authorization: Bearer avian-YOUR_API_KEY" \ -H "Content-Type: application/json" \ -N \ -d '{ "model": "deepseek/deepseek-v3.2", "messages": [ {"role": "user", "content": "Explain quantum computing"} ], "stream": true }'
The API returns standard HTTP status codes. Errors include a JSON body with a descriptive message.