# Connect clients Source: https://docs.getworg.com/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 - Base URL: `https://api.getworg.com/v1` - API key: `$WORG_API_KEY` - Model: `deepseek-v4.1-flash:cached` Enter 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/`. ## OpenAI SDK Pass the base URL and key when you create the client. The rest of your code stays the same. Python: ``` 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) ``` TypeScript: ``` 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. Python: ``` 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. Python: ``` 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. TypeScript: ``` 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`: opencode.json: ``` { "$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`: config.yaml: ``` model: default: deepseek-v4.1-flash:cached provider: custom base_url: https://api.getworg.com/v1 key_env: WORG_API_KEY ``` Other 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. > Give the agent its own key > > Coding agents send many requests and sometimes leave out `max_tokens`. Worg then holds the model's whole output limit for each request, so a key with a very small budget gets `402` even though each answer costs little. The error message states the hold. Create a separate key for the agent, with a budget that covers that hold, and revoke it when the work is done. See [Agent context](https://docs.getworg.com/ai-agents#agent-key). ## 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. Next: [Troubleshooting](https://docs.getworg.com/troubleshooting) · [Agent context](https://docs.getworg.com/ai-agents) · [Models and compatibility](https://docs.getworg.com/models)