Skip to Content
Using OpenAI SDKs

Using OpenAI SDKs

The API is OpenAI-compatible, so the official SDKs work with one change: the base URL.

pip install openai
import os from openai import OpenAI client = OpenAI( api_key=os.environ["DEVOTEL_API_KEY"], base_url="https://api.devotel.com/v1", # the only change ) response = client.chat.completions.create( model="kimi-k3", messages=[{"role": "user", "content": "Hello!"}], ) print(response.choices[0].message.content)

Or set it in the environment and leave your code untouched:

export OPENAI_API_KEY="dvt-..." export OPENAI_BASE_URL="https://api.devotel.com/v1"
from openai import OpenAI client = OpenAI() # reads both variables

Async works the same way with AsyncOpenAI.

Both SDKs can run in a browser (dangerouslyAllowBrowser). Do not do that with a Devotel key — anything in browser code is visible to the user. Proxy through your own server.

Reading reasoning_content through the SDKs

reasoning_content is not part of the OpenAI SDKs’ typed models, so the type definitions do not mention it even though the field is in the response. Read it dynamically:

message = response.choices[0].message reasoning = getattr(message, "reasoning_content", None)
const message = response.choices[0]!.message as (typeof response.choices)[0]['message'] & { reasoning_content?: string } const reasoning = message.reasoning_content

Both SDKs also expose the raw payload if you would rather not cast:

raw = response.model_dump() reasoning = raw["choices"][0]["message"].get("reasoning_content")

What works and what does not

SDK surfaceStatus
chat.completions.createWorks, streaming and not
tools / tool_choice, streaming helpersWorks — see Tool Calling
models.listWorks
embeddings.createNot implemented — returns 404
completions.create (legacy)Not implemented — returns 404
images, audio, assistants, batchesNot implemented

Frameworks

Anything that accepts an OpenAI base URL works. For example, LangChain:

from langchain_openai import ChatOpenAI llm = ChatOpenAI( model="kimi-k3", api_key="dvt-...", base_url="https://api.devotel.com/v1", )

The same applies to the Vercel AI SDK’s OpenAI-compatible provider, LlamaIndex, Instructor and similar libraries. If a framework needs an endpoint other than chat completions or models, it will not work yet.

Retries and timeouts

The SDKs retry 429 and 5xx with backoff by default. Keep that on, and give reasoning-heavy requests a generous timeout — a single Kimi K3 answer can spend several hundred reasoning tokens before its first visible character:

client = OpenAI( api_key="dvt-...", base_url="https://api.devotel.com/v1", timeout=120.0, max_retries=3, )