SDKs
Official and community SDKs for CPAI.
OpenAI Python SDK
Section titled “OpenAI Python SDK”Use the official OpenAI SDK with our API by changing the base URL:
from openai import OpenAI
client = OpenAI( base_url="http://localhost:8080/v1", api_key="your-api-key" # Your CPAI API key)
response = client.chat.completions.create( model="kimi-k2.5", messages=[{"role": "user", "content": "Hello!"}])
print(response.choices[0].message.content)JavaScript/TypeScript
Section titled “JavaScript/TypeScript”Use the OpenAI JavaScript SDK:
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'http://localhost:8080/v1', apiKey: 'your-api-key'});
const response = await client.chat.completions.create({ model: 'kimi-k2.5', messages: [{ role: 'user', content: 'Hello!' }]});
console.log(response.choices[0].message.content);HTTP Client (Any Language)
Section titled “HTTP Client (Any Language)”Since we support the OpenAI API format, you can use any HTTP client:
curl http://localhost:8080/v1/chat/completions \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "kimi-k2.5", "messages": [{"role": "user", "content": "Hello!"}] }'Coming Soon
Section titled “Coming Soon”- Official Python SDK with additional features
- Official JavaScript/TypeScript SDK
- Go SDK
- Rust SDK