SosoGPT API Docs
OpenAI-compatible API gateway. Available models, groups, routing, and final charges depend on your console configuration and usage logs.
1. Quickstart
Main endpoint:
https://api.sosogpt.com
OpenAI-compatible Base URL:
https://api.sosogpt.com/v1
| Endpoint | Purpose |
|---|---|
GET /v1/models | List models available to the current API key. |
POST /v1/chat/completions | OpenAI Chat Completions format. |
POST /v1/responses | OpenAI Responses format. |
POST /v1/messages | Anthropic-compatible Messages format for Claude Code. |
2. Create and Use API Keys
- Sign in to the console.
- Open Token Management.
- Create an API key and choose the group you need.
- Save the key. The full key is usually shown only once.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Do not expose API keys in frontend code, public repositories, or client packages. Delete and recreate leaked keys immediately.
3. Models
Different token groups may see different model lists. Query available models with your own API key:
curl https://api.sosogpt.com/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
Model names must match the returned names exactly, including case, hyphens, and version suffixes.
4. Examples
Chat Completions
curl https://api.sosogpt.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "Introduce yourself in one sentence"
}
],
"stream": false
}'
Streaming
curl https://api.sosogpt.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "Write a short product intro"
}
],
"stream": true
}'
Node.js SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.SOSOGPT_API_KEY,
baseURL: "https://api.sosogpt.com/v1",
});
const completion = await client.chat.completions.create({
model: "gpt-5.4-mini",
messages: [{ role: "user", content: "Hello, introduce yourself" }],
});
console.log(completion.choices[0].message.content);
Python SDK
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.sosogpt.com/v1"
)
response = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[
{"role": "user", "content": "Hello, introduce yourself"}
]
)
print(response.choices[0].message.content)
5. Codex CLI and Claude Code
Create an API key first and make sure its group has access to the model you want.
CLI Prerequisites
Codex CLI and Claude Code require Node.js and npm. Use the current LTS version.
node -v
npm -v
Linux or macOS with nvm:
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source ~/.bashrc
nvm install --lts
nvm use --lts
node -v
npm -v
Windows PowerShell:
winget install -e --id OpenJS.NodeJS.LTS
node -v
npm -v
Codex CLI
npm i -g @openai/codex
codex --version
Create the config directory:
mkdir -p ~/.codex
chmod 700 ~/.codex
Create or edit ~/.codex/config.toml:
model_provider = "sosogpt"
model = "gpt-5.5"
model_reasoning_effort = "medium"
disable_response_storage = true
cli_auth_credentials_store = "file"
[model_providers.sosogpt]
name = "SosoGPT"
base_url = "https://api.sosogpt.com/v1"
wire_api = "responses"
requires_openai_auth = true
Current Codex Base URL:
https://api.sosogpt.com/v1
Create or edit ~/.codex/auth.json and replace YOUR_API_KEY:
{
"OPENAI_API_KEY": "YOUR_API_KEY"
}
codex
codex -m gpt-5.5
codex -m gpt-5.4-mini
Claude Code
Claude Code uses the Anthropic protocol, not OpenAI Chat Completions. SosoGPT provides an Anthropic-compatible endpoint.
npm i -g @anthropic-ai/claude-code
claude --version
mkdir -p ~/.claude
chmod 700 ~/.claude
Create or edit ~/.claude/settings.json and replace YOUR_API_KEY:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://api.sosogpt.com"
}
}
Current Claude Code Base URL:
https://api.sosogpt.com
claude
Use CC Switch to Manage Keys
CC Switch can manage providers and keys for Claude Code, Codex, OpenAI-compatible clients, or multiple API keys.
https://github.com/farion1231/cc-switch/releases
- Windows: choose
CC-Switch-v{version}-Windows.msi, orWindows-Portable.zipif you prefer portable mode. - macOS: choose
CC-Switch-v{version}-macOS.dmg, or install with Homebrew. - Linux: use
Linux.debfor Ubuntu/Debian,Linux.rpmfor Fedora/RHEL/openSUSE, orLinux.AppImageas a generic option.
Auto Import CC Switch Configuration
- Open Token Management in the SosoGPT console.
- Create an API key for your local client and choose the desired group.
- Find the Chat button on the right side of the token row.
- Open the dropdown next to Chat and choose
CC Switch. - Your browser will launch CC Switch and import the endpoint, key, and provider configuration.
- Confirm that the SosoGPT provider is active, then return to the corresponding client.
Manual CC Switch Configuration
| Name | SosoGPT |
|---|---|
| Application | Choose the actual client, such as Claude Code or Codex. |
| Base URL | Claude Code: https://api.sosogpt.com; Codex / OpenAI-compatible clients: https://api.sosogpt.com/v1 |
| API Key / Auth Token | Use the API key created in the SosoGPT console. |
| Model | Choose a model available to the current token group, for example claude-sonnet-4-6, gpt-5.5, or gpt-5.4-mini. |
claude
codex
6. Groups and Billing
SosoGPT uses token groups to control model access, routing, and billing ratios. Different groups may have different routes, models, and prices.
- Model ratio
- Group ratio
- Input and output tokens
- Cached tokens
- Model capability and upstream route cost
Marketplace prices are references. Final charges are based on console usage logs.
7. Common Errors
| Error | Likely Cause | Action |
|---|---|---|
401 Unauthorized | Missing or invalid API key | Check Authorization: Bearer YOUR_API_KEY. |
404 Invalid URL | Wrong path | Use /v1/chat/completions, /v1/responses, or /v1/messages. |
429 Too Many Requests | Rate limit, insufficient balance, or quota limit | Retry later or check balance and token limits. |
500 / 502 / 503 | Upstream route issue, model unavailable, or network fluctuation | Retry later or switch model/group if needed. |
When reporting issues, keep the Request ID, model name, request time, and full error message.