Developer documentation
Connect your application or coding harness to Central Hub AI using your endpoint, API key, and model ID.
Documentation reviewed on 10/8/2026
Quickstart
Create a key, select an available model below, and copy the request for its recommended API. The same endpoint and credentials work with compatible SDKs and coding tools.
https://codeforge-oaic.centralhubai.com/v1This base URL includes /v1. Append the request path once, or pass the base URL to your OpenAI client.
Authentication
Open CodeForge Console → API Keys to create a named key and manage its lifecycle. Sign in to manage your own keys. Never share a key or commit it to source control.
Manage API keys| Action | Value |
|---|---|
| Create and name | Give each application a recognizable key name. Save the key when it is created. |
| Reveal and copy | Use the copy/reveal controls and the remaining reveal allowance shown on the API Keys page. When copying is unavailable, rotate the key and save the replacement. |
| Rotate | Rotation replaces the secret. Update every application using the previous value before making another request. |
| Revoke | Revoke a key to stop its use. Requests using a revoked, expired, disabled, or deleted key fail authentication. |
| Delete | Delete a key through the existing management page when it is no longer needed. |
Set your key in an environment variable
Replace YOUR_API_KEY locally. These documentation examples contain placeholders only; this page never creates or reveals a key.
$env:CODEFORGE_API_KEY = "YOUR_API_KEY"export CODEFORGE_API_KEY="YOUR_API_KEY"Request headers
OpenAI examples use Authorization: Bearer. Anthropic examples use x-api-key and anthropic-version. Both key formats are accepted by the gateway. Inference requests use API-key authentication, independently of your browser session.
Models
Limits and reasoning settings come from the live Central Hub catalog. The public catalog is an overview; the models available to your API key depend on your account’s access policy.
| Model | Context window (tokens) | Maximum input (tokens) | Maximum output (tokens) | Reasoning levels |
|---|---|---|---|---|
DeepSeek-V4.1-Flash (CH-AI)DeepSeek-V4.1-Flash | 1,000,000 | 128,000 | 384,000 | low medium (Default) high max |
DeepSeek-V4-Pro (CH-AI)DeepSeek-V4-Pro | 1,000,000 | 128,000 | 384,000 | medium (Default) high max |
GLM-5.3 (CH-AI)GLM-5.3 | 1,000,000 | 128,000 | 131,072 | low (Default) high max |
GLM-5.3-Flash (CH-AI)GLM-5.3-Flash | 1,000,000 | 128,000 | 131,072 | low (Default) high max |
GPT-5.5 (CH-AI)GPT-5.5 | 272,000 | 128,000 | 128,000 | low (Default) medium high xhigh |
GPT-5.6-Luna (CH-AI)GPT-5.6-Luna | 1,050,000 | 128,000 | 128,000 | low (Default) medium high xhigh max |
GPT-5.6-Sol (CH-AI)GPT-5.6-Sol | 272,000 | 128,000 | 128,000 | low (Default) medium high xhigh max ultra |
GPT-5.6-Terra (CH-AI)GPT-5.6-Terra | 272,000 | 128,000 | 128,000 | low (Default) medium high xhigh max ultra |
GPT-6.1-Sol (CH-AI)GPT-6.1-Sol | 272,000 | 128,000 | 128,000 | low (Default) medium high xhigh max ultra |
GPT-6-Luna (CH-AI)GPT-6-Luna | 1,050,000 | 128,000 | 128,000 | low (Default) medium high xhigh max |
GPT-6-Sol (CH-AI)GPT-6-Sol | 272,000 | 128,000 | 128,000 | low (Default) medium high xhigh max ultra |
Grok-4.5 (CH-AI)Grok-4.5 | 500,000 | 128,000 | 33,000 | low medium (Default) high |
Kimi-K2.6 (CH-AI)Kimi-K2.6 | 262,128 | 128,000 | 262,128 | Not specified |
Kimi-K2.7-Code (CH-AI)Kimi-K2.7-Code | 262,144 | 128,000 | 262,144 | Not specified |
Minimax-M2.7 (CH-AI)Minimax-M2.7 | 196,608 | 128,000 | 196,608 | low (Default) medium high |
Minimax-M3 (CH-AI)Minimax-M3 | 512,000 | 128,000 | 512,000 | low (Default) medium high |
Qwen3.7-Plus (CH-AI)Qwen3.7-Plus | 1,000,000 | 128,000 | 64,000 | Not specified |
No models are available in this catalog. You can still read the guides and use the public catalog.
Selecting a model updates API examples and tool configurations. Use its recommended API first; a route existing on the gateway does not mean every model supports it.
Selected model
- Model
- DeepSeek-V4.1-Flash (CH-AI)
- API model ID
- DeepSeek-V4.1-Flash
- Proxy model name
- DeepSeek-V4.1-Flash
- Recommended API
- chat/completions
- Context window (tokens)
- 1,000,000
- Maximum input (tokens)
- 128,000
- Maximum output (tokens)
- 384,000
- Catalog capabilities
- Text, Web search, Vision, News search
- Input modalities
- Not specified
- Output modalities
- Text
- Reasoning levels
- low — Default; medium (Default) — Medium; high — High; max — Max
- OpenCode provider ID
- codeforge-oaic
- OpenCode provider package
- @ai-sdk/openai-compatible
Discover models with your key
GET /v1/models lists models available to your key. Use the returned id exactly. Catalog metadata is separate from the official inference request and response formats.
curl "https://codeforge-oaic.centralhubai.com/v1/models" -H "Authorization: Bearer $CODEFORGE_API_KEY"Protocol compatibility
The gateway exposes all three routes. OpenAI and Codex models prefer Responses; OpenAI-compatible models prefer Chat Completions; Anthropic models prefer Messages. Existing bridges connect Responses and Messages for supported OpenAI, Codex, and Anthropic routes. Availability and provider-hosted features still depend on the model and configured providers.
Chat Completions
POST /v1/chat/completions
Send a messages array. Read the assistant message from choices, finish_reason for completion status, and usage for token counts. Streaming returns chunks with incremental delta content.
This example uses a different protocol from the selected model’s recommended API. Check compatibility before running it.
Examples use official API formats with your endpoint and model ID. Responses below are illustrative; IDs, usage, and additional fields vary. Save the request JSON as request.json before running cURL. On PowerShell, use curl.exe and adapt shell quoting, or use the SDK examples.
{
"model": "DeepSeek-V4.1-Flash",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}
curl "https://codeforge-oaic.centralhubai.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CODEFORGE_API_KEY" \
--data-binary @request.json
import os
from openai import OpenAI
# pip install openai
client = OpenAI(api_key=os.environ["CODEFORGE_API_KEY"], base_url="https://codeforge-oaic.centralhubai.com/v1")
completion = client.chat.completions.create(
model="DeepSeek-V4.1-Flash", messages=[{"role": "user", "content": "Hello!"}])
print(completion.choices[0].message.content)
import OpenAI from "openai";
// npm install openai
const client = new OpenAI({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com/v1"
});
const completion = await client.chat.completions.create({
model: "DeepSeek-V4.1-Flash", messages: [{ role: "user", content: "Hello!" }]
});
console.log(completion.choices[0].message.content);
{
"id": "chatcmpl_example", "object": "chat.completion", "created": 1791417600,
"model": "DeepSeek-V4.1-Flash",
"choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello!" }, "finish_reason": "stop" }],
"usage": { "prompt_tokens": 10, "completion_tokens": 4, "total_tokens": 14 }
}
import OpenAI from "openai";
// npm install openai
const client = new OpenAI({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com/v1"
});
const stream = await client.chat.completions.create({
model: "DeepSeek-V4.1-Flash", messages: [{ role: "user", content: "Hello!" }], stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
Set stream to true to receive server-sent events. With cURL, add -N and set stream in request.json. Chat Completions emits delta chunks and [DONE]; Responses emits typed response events; Messages emits message and content-block events. Handle errors and terminal events as well as text deltas.
import OpenAI from "openai";
// npm install openai
const client = new OpenAI({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com/v1"
});
const parameters = {
type: "object", properties: { city: { type: "string" } },
required: ["city"], additionalProperties: false
};
// Replace this example function with your own validated tool implementation.
const getWeather = ({ city }) => ({ city, temperature_c: 22 });
const tools = [{ type: "function", function: { name: "get_weather", description: "Get weather for a city", parameters } }];
const messages = [{ role: "user", content: "What is the weather in Cape Town?" }];
const first = await client.chat.completions.create({ model: "DeepSeek-V4.1-Flash", messages, tools });
const assistant = first.choices[0].message;
const calls = assistant.tool_calls ?? [];
if (calls.length) {
const results = calls.map(call => {
if (call.type !== "function" || call.function.name !== "get_weather") throw new Error("Unknown tool");
return { role: "tool", tool_call_id: call.id, content: JSON.stringify(getWeather(JSON.parse(call.function.arguments))) };
});
const final = await client.chat.completions.create({ model: "DeepSeek-V4.1-Flash", tools, messages: [...messages, assistant, ...results] });
console.log(final.choices[0].message.content);
} else console.log(assistant.content);
Use a model that supports function calling. Your application executes tools, validates arguments, and returns results with the original call ID. These examples include one tool round trip; repeat the loop if the model requests more tools. The weather result is demonstration data.
Official referenceResponses
POST /v1/responses
Send input as text or an array of input items. Raw JSON returns an output array containing messages, reasoning, or function calls. The SDK’s output_text is a convenience accessor, not a raw JSON response field.
This example uses a different protocol from the selected model’s recommended API. Check compatibility before running it.
Examples use official API formats with your endpoint and model ID. Responses below are illustrative; IDs, usage, and additional fields vary. Save the request JSON as request.json before running cURL. On PowerShell, use curl.exe and adapt shell quoting, or use the SDK examples.
{
"model": "DeepSeek-V4.1-Flash",
"input": "Hello!"
}
curl "https://codeforge-oaic.centralhubai.com/v1/responses" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CODEFORGE_API_KEY" \
--data-binary @request.json
import os
from openai import OpenAI
# pip install openai
client = OpenAI(api_key=os.environ["CODEFORGE_API_KEY"], base_url="https://codeforge-oaic.centralhubai.com/v1")
response = client.responses.create(model="DeepSeek-V4.1-Flash", input="Hello!")
print(response.output_text)
import OpenAI from "openai";
// npm install openai
const client = new OpenAI({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com/v1"
});
const response = await client.responses.create({ model: "DeepSeek-V4.1-Flash", input: "Hello!" });
console.log(response.output_text);
{
"id": "resp_example", "object": "response", "created_at": 1791417600,
"status": "completed", "model": "DeepSeek-V4.1-Flash",
"output": [{
"id": "msg_example", "type": "message", "role": "assistant", "status": "completed",
"content": [{ "type": "output_text", "text": "Hello!", "annotations": [] }]
}],
"usage": { "input_tokens": 10, "output_tokens": 4, "total_tokens": 14 }
}
import OpenAI from "openai";
// npm install openai
const client = new OpenAI({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com/v1"
});
const stream = await client.responses.create({ model: "DeepSeek-V4.1-Flash", input: "Hello!", stream: true });
for await (const event of stream) {
if (event.type === "response.output_text.delta") process.stdout.write(event.delta);
}
Set stream to true to receive server-sent events. With cURL, add -N and set stream in request.json. Chat Completions emits delta chunks and [DONE]; Responses emits typed response events; Messages emits message and content-block events. Handle errors and terminal events as well as text deltas.
import OpenAI from "openai";
// npm install openai
const client = new OpenAI({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com/v1"
});
const parameters = {
type: "object", properties: { city: { type: "string" } },
required: ["city"], additionalProperties: false
};
// Replace this example function with your own validated tool implementation.
const getWeather = ({ city }) => ({ city, temperature_c: 22 });
const tools = [{ type: "function", name: "get_weather", description: "Get weather for a city", parameters, strict: true }];
const input = [{ role: "user", content: "What is the weather in Cape Town?" }];
const first = await client.responses.create({ model: "DeepSeek-V4.1-Flash", input, tools, store: false });
const calls = first.output.filter(item => item.type === "function_call");
if (calls.length) {
const results = calls.map(call => {
if (call.name !== "get_weather") throw new Error("Unknown tool");
return { type: "function_call_output", call_id: call.call_id, output: JSON.stringify(getWeather(JSON.parse(call.arguments))) };
});
const final = await client.responses.create({
model: "DeepSeek-V4.1-Flash", tools, store: false, input: [...input, ...first.output, ...results]
});
console.log(final.output_text);
} else console.log(first.output_text);
Use a model that supports function calling. Your application executes tools, validates arguments, and returns results with the original call ID. These examples include one tool round trip; repeat the loop if the model requests more tools. The weather result is demonstration data.
Official referenceMessages
POST /v1/messages
Send messages and max_tokens. System instructions use the top-level system field. Read content blocks, stop_reason, and usage. Keep the anthropic-version header when making raw HTTP requests.
This example uses a different protocol from the selected model’s recommended API. Check compatibility before running it.
Examples use official API formats with your endpoint and model ID. Responses below are illustrative; IDs, usage, and additional fields vary. Save the request JSON as request.json before running cURL. On PowerShell, use curl.exe and adapt shell quoting, or use the SDK examples.
{
"model": "DeepSeek-V4.1-Flash",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}
curl "https://codeforge-oaic.centralhubai.com/v1/messages" \
-H "Content-Type: application/json" \
-H "x-api-key: $CODEFORGE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
--data-binary @request.json
import os
from anthropic import Anthropic
# pip install anthropic
client = Anthropic(api_key=os.environ["CODEFORGE_API_KEY"],
base_url="https://codeforge-oaic.centralhubai.com")
message = client.messages.create(
model="DeepSeek-V4.1-Flash", max_tokens=256,
messages=[{"role": "user", "content": "Hello!"}])
print("".join(block.text for block in message.content if block.type == "text"))
import Anthropic from "@anthropic-ai/sdk";
// npm install @anthropic-ai/sdk
const client = new Anthropic({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com"
});
const message = await client.messages.create({
model: "DeepSeek-V4.1-Flash", max_tokens: 256,
messages: [{ role: "user", content: "Hello!" }]
});
console.log(message.content.filter(b => b.type === "text").map(b => b.text).join(""));
{
"id": "msg_example", "type": "message", "role": "assistant",
"model": "DeepSeek-V4.1-Flash", "content": [{ "type": "text", "text": "Hello!" }],
"stop_reason": "end_turn", "stop_sequence": null,
"usage": { "input_tokens": 10, "output_tokens": 4 }
}
import Anthropic from "@anthropic-ai/sdk";
// npm install @anthropic-ai/sdk
const client = new Anthropic({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com"
});
const stream = await client.messages.create({
model: "DeepSeek-V4.1-Flash", max_tokens: 256, stream: true,
messages: [{ role: "user", content: "Hello!" }]
});
for await (const event of stream) {
if (event.type === "content_block_delta" && event.delta.type === "text_delta") {
process.stdout.write(event.delta.text);
}
}
Set stream to true to receive server-sent events. With cURL, add -N and set stream in request.json. Chat Completions emits delta chunks and [DONE]; Responses emits typed response events; Messages emits message and content-block events. Handle errors and terminal events as well as text deltas.
import Anthropic from "@anthropic-ai/sdk";
// npm install @anthropic-ai/sdk
const client = new Anthropic({
apiKey: process.env.CODEFORGE_API_KEY,
baseURL: "https://codeforge-oaic.centralhubai.com"
});
const parameters = {
type: "object", properties: { city: { type: "string" } },
required: ["city"], additionalProperties: false
};
// Replace this example function with your own validated tool implementation.
const getWeather = ({ city }) => ({ city, temperature_c: 22 });
const tools = [{ name: "get_weather", description: "Get weather for a city", input_schema: parameters }];
const messages = [{ role: "user", content: "What is the weather in Cape Town?" }];
const first = await client.messages.create({ model: "DeepSeek-V4.1-Flash", max_tokens: 1024, tools, messages });
const calls = first.content.filter(b => b.type === "tool_use");
if (calls.length) {
const results = calls.map(call => {
if (call.name !== "get_weather") throw new Error("Unknown tool");
return { type: "tool_result", tool_use_id: call.id, content: JSON.stringify(getWeather(call.input)) };
});
const final = await client.messages.create({
model: "DeepSeek-V4.1-Flash", max_tokens: 1024, tools,
messages: [...messages, { role: "assistant", content: first.content }, { role: "user", content: results }]
});
console.log(final.content);
} else console.log(first.content);
Use a model that supports function calling. Your application executes tools, validates arguments, and returns results with the original call ID. These examples include one tool round trip; repeat the loop if the model requests more tools. The weather result is demonstration data.
Official referenceOpenCode
Install OpenCode, set CODEFORGE_API_KEY, and merge the generated configuration into opencode.json in your project or ~/.config/opencode/opencode.json. Preserve your existing settings. Restart OpenCode and select the configured provider/model with /models.
This configuration reads the key from your environment. Alternatively, use /connect → Other with the provider ID shown below, and omit options.apiKey so OpenCode uses the saved credential.
npm install -g opencode-ai{
"$schema": "https://opencode.ai/config.json",
"model": "codeforge-oaic/DeepSeek-V4.1-Flash",
"provider": {
"codeforge-oaic": {
"npm": "@ai-sdk/openai-compatible",
"name": "Central Hub AI",
"options": {
"baseURL": "https://codeforge-oaic.centralhubai.com/v1",
"apiKey": "{env:CODEFORGE_API_KEY}"
},
"models": {
"DeepSeek-V4.1-Flash": {
"name": "DeepSeek-V4.1-Flash (CH-AI)",
"limit": {
"context": 1000000,
"input": 128000,
"output": 384000
},
"reasoning": true,
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"max": {
"reasoningEffort": "max",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
}
}
}
}
}Codex
Install the official Codex CLI, set CODEFORGE_API_KEY, and merge the configuration below into your user-level ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml). Keep your existing settings and provider entries. Launch codex from your project directory.
npm install -g @openai/codexCodex uses the Responses protocol. The model_catalog_json artifact in the existing setup guide adds model discovery and metadata. Reasoning settings are included only when advertised by the catalog.
Select a model compatible with Responses to generate Codex configuration.Other harnesses
For any client that supports a custom provider, copy these connection settings. Match the protocol to the selected model. Token limits and reasoning controls are optional client settings when that client supports them.
| Client setting | Value |
|---|---|
| API base URL | https://codeforge-oaic.centralhubai.com/v1 |
| Full request URL | https://codeforge-oaic.centralhubai.com/v1/chat/completions |
| API key / credential | CODEFORGE_API_KEY |
| API model ID | DeepSeek-V4.1-Flash |
| Recommended API | chat/completions |
| Context window (tokens) | 1,000,000 |
| Maximum output (tokens) | 384,000 |
| Reasoning levels | low — Default; medium (Default) — Medium; high — High; max — Max |
OpenAI clients and OpenCode expect the base URL including /v1. The official Anthropic SDK appends /v1/messages itself, so its base URL is the root before /v1. Raw HTTP clients use the full request URL. Do not append /v1 or an endpoint twice.
Troubleshooting
| Symptom | What to check |
|---|---|
| 401 — invalid or missing key | Check the environment variable in the current terminal and the authentication header. Replace revoked, expired, disabled, or deleted keys. |
| 400 — missing model | Send valid JSON with the model field. Copy the API identifier, not the display label. |
| 404 — model unavailable | Check GET /v1/models with the same key. Public catalog visibility does not grant account access. |
| Access, credits, or usage limit reached | Check your subscription, API credit balance, and usage in CodeForge Console. Follow the error’s reset or payment guidance. |
| 429 — rate limit | Reduce concurrency and retry with backoff; honor Retry-After when present. Check account and upstream rate limits. |
| 503 — upstream unavailable | Check the selected model’s recommended protocol. If it is correct, retry later; an upstream connection or account may be temporarily unavailable. |
| Client cannot connect or finds no models | Check the base URL, avoid duplicate /v1, restart after changing environment variables, and configure the exact model ID and supported protocol. |