Quickstart
Calling CodaAPI takes three things, an API key, a base URL and a model name. Get them ready and send your first request.
Calling CodaAPI takes three things: an API key, a base URL and a model name. CodaAPI speaks the OpenAI, Anthropic (Claude) and Gemini API formats, so code that already uses those official SDKs usually only needs a new address and key, plus a model name. This page walks through each of the three, then makes the first call.
API key
- Open the console sign-in page. No account yet? Sign up first.
- In the left menu, go to General → API Keys (open it directly) and click Create API Key at the top right.
- Enter a Name, then choose a group under Group. The group decides which models the key can call and which multiplier it is billed at, so pick one that contains the models you want; see Groups for what each group has. To run the examples on this page as they are, choose
OpenAI-官转; for tools such as Claude Code and Codex, choose the group given on each tool's page. Leave the rest at the defaults for now: Expiration Time is Never and Unlimited Quota is on. You can change the spending cap and model limits later; see Overview. Click Save changes. - Open the menu on that key's row and choose Copy Key. You get a string starting with
sk-. You can come back and copy it again at any time.
Requests are paid from your account balance, and are refused when the balance runs out. Top up under Personal → Wallet (open it directly); see Pricing and multipliers for how charges are calculated.
An API key can spend your balance. Never put it in front-end code, commit it to a public repository or paste it into a group chat. If it leaks, disable or delete it on the API Keys page and create a new one.
Base URL
All OpenAI-compatible endpoints live under this address:
https://codaapi.com/v1
Tools differ in how they want the address: some need the /v1 suffix, while others want only the root address and append the rest of the path themselves. Use this table:
| Tool | What to enter as the base URL | Notes |
|---|---|---|
| The official OpenAI SDKs (Python, Node.js) and most OpenAI-compatible tools | https://codaapi.com/v1 |
With /v1. The SDK appends endpoint paths such as /chat/completions |
| Claude Code, the Anthropic SDK | https://codaapi.com |
The root address without /v1. The tool appends /v1/messages. See Claude Code |
| Gemini CLI, google-genai | https://codaapi.com |
The root address without /v1beta. The tool appends the endpoint path. See Gemini CLI |
| Tools that complete the path themselves, such as Cherry Studio | https://codaapi.com |
Cherry Studio appends /v1/chat/completions automatically. See Cherry Studio |
| Tools that ask for the full request URL | https://codaapi.com/v1/chat/completions |
The address already contains the endpoint path, and the tool requests it as is |
If you're not sure, check whether the tool asks for a "base URL" (stop at /v1) or a "request URL" or "endpoint" (include the specific endpoint). The API Addresses button at the top right of the console's API Keys page also shows the addresses and lets you copy them.
The official OpenAI SDKs (Python and Node.js) read these two environment variables automatically, so your code doesn't need to hard-code the address or key:
# macOS / Linux
export OPENAI_BASE_URL="https://codaapi.com/v1"
export OPENAI_API_KEY="sk-your-key"
# Windows PowerShell (current window only)
$env:OPENAI_BASE_URL = "https://codaapi.com/v1"
$env:OPENAI_API_KEY = "sk-your-key"
Model name
The model field of a request decides which model is called. Three things to get right:
- Copy it from Model Square. Open Model Square and use the copy button next to the model name (Copy model name) instead of typing it from memory.
- Match it exactly. Case, hyphens, dots and date suffixes must all be the same as in Model Square, for example
claude-sonnet-5-5orgpt-5.4-mini. A display name such as "Claude Sonnet 5.5" won't work. - It must be in your key's group. A key can only call the models in its group. Choose your key's group under the Groups filter on the left of Model Square to see exactly the models that key can use. You can also call
GET /v1/modelswith the key, which returns the model names it can use. See Groups for the models in each group.
If the model name is wrong, or the model isn't in your key's group, the gateway returns 404 with an error saying the model is not configured for any group available to the request. See Error codes for what to do.
Make your first call
All three examples call the OpenAI-compatible chat endpoint POST /v1/chat/completions with the model gpt-5.4-mini, which is in the OpenAI-官转 group. If your key is in another group, replace the model name with one from that group. See Model Square for the price of each model.
curl
curl https://codaapi.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4-mini",
"messages": [{"role": "user", "content": "Hello, CodaAPI"}]
}'
Python (pip install openai)
from openai import OpenAI
# With no arguments, the client reads OPENAI_BASE_URL and OPENAI_API_KEY
client = OpenAI()
response = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[{"role": "user", "content": "Hello, CodaAPI"}],
)
print(response.choices[0].message.content)
Node.js (npm install openai)
import OpenAI from 'openai';
// With no arguments, the client reads OPENAI_BASE_URL and OPENAI_API_KEY
const client = new OpenAI();
const completion = await client.chat.completions.create({
model: 'gpt-5.4-mini',
messages: [{ role: 'user', content: 'Hello, CodaAPI' }],
});
console.log(completion.choices[0].message.content);
Once the request succeeds, General → Usage Logs (open it directly) shows the model, token counts and charge for it.
Next steps
- Use the native Claude or Gemini formats: API reference
- Use a coding tool: Claude Code, Codex, more tools
- Learn about groups and pricing: Groups, Pricing and multipliers
If something goes wrong
Start with Troubleshooting: look up the status code and error message in Error codes, and if you can't connect or keep getting 401, run the environment check first.
If you still can't solve it, contact us and include these three things:
- Account: the email address or username you signed up with.
- The failing request: when it happened, the model name, and which key you used (give the key's name only; never send the key itself).
- The error text or a screenshot: the full error message, or a screenshot of the error in your tool.