Using OpenAI SDKs
The API is OpenAI-compatible, so the official SDKs work with one change: the base URL.
Python
pip install openaiimport 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 variablesAsync 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_contentBoth 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 surface | Status |
|---|---|
chat.completions.create | Works, streaming and not |
tools / tool_choice, streaming helpers | Works — see Tool Calling |
models.list | Works |
embeddings.create | Not implemented — returns 404 |
completions.create (legacy) | Not implemented — returns 404 |
images, audio, assistants, batches | Not 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,
)