Model API
The Entrim Model API serves open-source models through an OpenAI-compatible HTTP API. Anything that already works with the OpenAI API, whether that's an SDK, a framework or a coding agent, works with Entrim once you change three things: the base URL, the API key and the model name.
Base URL
https://api.entrim.ai/v1
Authentication
Create an API key in the Entrim Dashboard under API Keys and send it as a bearer token with every request:
Authorization: Bearer <your-api-key>
The examples in these docs read the key from the ENTRIM_API_KEY environment variable:
export ENTRIM_API_KEY="<your-api-key>"
Anyone with your API key can spend your credits. Keep it out of source control and client-side code. If a key leaks, rotate it in the dashboard. See API keys.
Make your first request
- curl
- Python
- TypeScript
curl https://api.entrim.ai/v1/chat/completions \
-H "Authorization: Bearer $ENTRIM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zai-org/GLM-5.3-Flash",
"messages": [
{"role": "user", "content": "Write a haiku about the Julian Alps."}
]
}'
pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.entrim.ai/v1",
api_key=os.environ["ENTRIM_API_KEY"],
)
response = client.chat.completions.create(
model="zai-org/GLM-5.3-Flash",
messages=[{"role": "user", "content": "Write a haiku about the Julian Alps."}],
)
print(response.choices[0].message.content)
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.entrim.ai/v1",
apiKey: process.env.ENTRIM_API_KEY,
});
const response = await client.chat.completions.create({
model: "zai-org/GLM-5.3-Flash",
messages: [{ role: "user", content: "Write a haiku about the Julian Alps." }],
});
console.log(response.choices[0].message.content);
The response has the same shape as an OpenAI chat completion. Chat completions covers every request parameter, streaming, tool calling and images.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/models | List the models your API key can use |
POST | /v1/chat/completions | Generate the next message in a conversation |
Use Entrim in your tools
Any tool that lets you add an OpenAI-compatible provider can use Entrim. These guides walk through the setup step by step:
- Cline: the open-source coding agent for VS Code
- Cursor: the AI code editor
- GitHub Copilot: Copilot Chat in VS Code
- opencode: the open-source coding agent for your terminal
- Pi: the minimal, extensible terminal coding agent
Credits and usage
Model API usage is paid from prepaid credits. You can check your credit balance and add credits under Billing, and follow your spending under Usage.