Connect clients
Worg speaks the OpenAI Chat Completions API, so most clients only need a base URL, a key and a model ID. Every example on this page was run before it was published.
The three settings
https://api.getworg.com/v1$WORG_API_KEYdeepseek-v4.1-flash:cachedEnter the base URL exactly as shown, with /v1 and nothing after it. Clients add /chat/completions themselves. Read the key from an environment variable rather than writing it into a config file. Any ID from GET /v1/models works as the model, and so does combo/<name>.
OpenAI SDK
Pass the base URL and key when you create the client. The rest of your code stays the same.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.getworg.com/v1",
api_key=os.environ["WORG_API_KEY"],
)
response = client.chat.completions.create(
model="deepseek-v4.1-flash:cached",
messages=[{"role": "user", "content": "Say hello in Indonesian."}],
max_tokens=512,
)
print(response.model)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.getworg.com/v1",
apiKey: process.env.WORG_API_KEY,
});
const response = await client.chat.completions.create({
model: "deepseek-v4.1-flash:cached",
messages: [{ role: "user", content: "Say hello in Indonesian." }],
max_tokens: 512,
});
console.log(response.model);
console.log(response.choices[0].message.content);LiteLLM
Put openai/ in front of the model ID. It tells LiteLLM to use the OpenAI format, and LiteLLM removes it before sending the request.
import os
import litellm
response = litellm.completion(
model="openai/deepseek-v4.1-flash:cached",
api_base="https://api.getworg.com/v1",
api_key=os.environ["WORG_API_KEY"],
messages=[{"role": "user", "content": "Say hello in Indonesian."}],
max_tokens=512,
)
print(response.model)
print(response.choices[0].message.content)LangChain
Use ChatOpenAI from langchain-openai with Worg's base URL.
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="deepseek-v4.1-flash:cached",
base_url="https://api.getworg.com/v1",
api_key=os.environ["WORG_API_KEY"],
max_tokens=512,
)
reply = llm.invoke("Say hello in Indonesian.")
print(reply.response_metadata["model_name"])
print(reply.content)Vercel AI SDK
Use the OpenAI-compatible provider. Streaming with streamText works the same way.
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const worg = createOpenAICompatible({
name: "worg",
baseURL: "https://api.getworg.com/v1",
apiKey: process.env.WORG_API_KEY,
});
const { text, response } = await generateText({
model: worg("deepseek-v4.1-flash:cached"),
prompt: "Say hello in Indonesian.",
maxOutputTokens: 512,
});
console.log(response.modelId);
console.log(text);If you use @ai-sdk/openai instead, call openai.chat("deepseek-v4.1-flash:cached"). Plain openai("…") calls the Responses API, which Worg does not have, and gets 404.
Coding agents
OpenCode, in opencode.json. Then pick the model as worg/deepseek-v4.1-flash:cached:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"worg": {
"npm": "@ai-sdk/openai-compatible",
"name": "Worg",
"options": {
"baseURL": "https://api.getworg.com/v1",
"apiKey": "{env:WORG_API_KEY}"
},
"models": {
"deepseek-v4.1-flash:cached": {
"name": "DeepSeek V4.1 Flash",
"limit": {
"context": 1048576,
"output": 8192
}
}
}
}
}
}Hermes Agent, in config.yaml:
model:
default: deepseek-v4.1-flash:cached
provider: custom
base_url: https://api.getworg.com/v1
key_env: WORG_API_KEYOther tools that accept an OpenAI-compatible base URL, a key and a model ID take the same three settings. This page lists only the tools we have run against Worg.
What does not work
Worg has two endpoints: POST /v1/chat/completions and GET /v1/models. A client that needs anything else gets 404:
- The Anthropic Messages API. Claude Code and other tools built on it cannot use Worg.
- The OpenAI Responses API, and clients that call only it.
- Embeddings, audio, image generation, files and batches.