Using the OpenAI SDK
The Onysoft API with the official OpenAI SDKs
The Onysoft API is compatible with the OpenAI API format. You can use your existing OpenAI SDKs by only changing the base_url and api_key values. The list of request fields that are passed through or ignored is in the Chat Completions section.
In non-streaming responses the OpenAI fields are at the top level; the SDK reads response.choices, response.usage and response.model directly. For backward compatibility the same content is also under data, and the request's charge is in the cost.amount field (USD). Error responses map to the SDK's error classes (AuthenticationError, RateLimitError …). client.models.list() gets the OpenAI list format, and the embeddings endpoint (/v1/embeddings) also supports the SDKs' default encoding_format: "base64" request. Any client that sends encoding_format: "base64" receives the vector as a base64 (float32) string, as with OpenAI; without the parameter or with "float" the vector is an array of numbers.
client.responses.create works with the same OpenAI SDK too (Responses API). For the Anthropic SDK see Anthropic Messages API; for embeddings and reranking see Embeddings, Rerank, STT.
Python SDK
pip install openai
from openai import OpenAI
# Usage with the Onysoft API
client = OpenAI(
api_key="sk-ony-your-api-key",
base_url="https://api.onysoft.com/v1"
)
# Chat, streaming, tool calls and JSON output are supported
response = client.chat.completions.create(
model="google/gemini-3.8-flash",
messages=[
{"role": "system", "content": "Sen yardımcı bir asistansın."},
{"role": "user", "content": "Merhaba!"}
],
temperature=0.7,
max_tokens=2000
)
print(response.choices[0].message.content)
Node.js SDK
npm install openai
import OpenAI from 'openai';
// Usage with the Onysoft API
const client = new OpenAI({
apiKey: 'sk-ony-your-api-key',
baseURL: 'https://api.onysoft.com/v1'
});
// Chat completion
const response = await client.chat.completions.create({
model: 'google/gemini-3.8-flash',
messages: [
{ role: 'system', content: 'Sen yardımcı bir asistansın.' },
{ role: 'user', content: 'Merhaba!' }
],
temperature: 0.7,
max_tokens: 2000
});
console.log(response.choices[0].message.content);