Use the OpenAI Agents SDK with GLM-5.3 or Kimi K3

Point the SDK's OpenAI client at InferSpeed's OpenAI-compatible endpoint and pick the model. Both the Responses and the Chat Completions model classes work, including function tools. You pay per token from a prepaid balance.

Last checked: 2026-10-18 (the date the site verified this config) · openai-agents 0.24.0

Setup

# pip install openai-agents
import asyncio, os
from openai import AsyncOpenAI
from agents import Agent, OpenAIResponsesModel, Runner, function_tool, set_tracing_disabled

set_tracing_disabled(True)  # traces go to OpenAI otherwise, with a key InferSpeed does not issue
client = AsyncOpenAI(base_url="https://api.inferspeed.ai/v1", api_key=os.environ["INFERSPEED_API_KEY"])

@function_tool
def get_time() -> str:
    """Returns the current time."""
    return "12:00"

agent = Agent(name="assistant", model=OpenAIResponsesModel(model="glm-5.3", openai_client=client), tools=[get_time])
print(asyncio.run(Runner.run(agent, "What time is it?")).final_output)

Create a key at https://inferspeed.ai/keys and export it as INFERSPEED_API_KEY. Use OpenAIChatCompletionsModel in place of OpenAIResponsesModel for /v1/chat/completions. Verified on 2026-10-18 with openai-agents 0.24.0.

For Kimi K3, create a key in the Kimi group and put kimi-k3 in place of glm-5.3.

Model names and routing

Price (USD per 1M tokens)

ModelInputOutputCache readVendor list price (in / out)
glm-5.3$0.84$2.64$0.156$1.40 / $4.40
kimi-k3$1.80$9.00$0.18$3.00 / $15.00

Live prices for every model: https://inferspeed.ai/model-plaza

Where the model comes from

glm-5.3 is published by Z.ai. It is served from the vendor's published model through more than one route; a route may run the vendor's FP8 weights on our own hardware. Vendor-reported scores and our own measurement method: https://inferspeed.ai/benchmarks.md

Limits

FAQ

How do I check what I was charged?
Call GET https://api.inferspeed.ai/v1/usage with your key: it returns today's and total tokens and actual_cost. How we check billing (charged amount equals billed tokens × published price) and how to run that check yourself: https://inferspeed.ai/benchmarks.md

We run InferSpeed.