API reference
Create a key in the console, keep it on your server, then send OpenAI-compatible or Anthropic-compatible requests. Account endpoints use a different credential.
If you only need a first request, start at Quickstart. Public USD prices are on Pricing and in pricing.json. Failed calls are covered in Errors.
Two credentials
Do not mix these. Model calls use an API key. Account endpoints use a system access token.
| Credential | Looks like | Used for | Where to create |
|---|---|---|---|
| API key | sk-... |
Model calls (/v1/...) |
API keys |
| System access token | A random string that does not start with sk- |
Account endpoints (/api/...) |
Account settings → Security settings |
Creating an API key:
- Open API keys.
- Create a key and copy the full
sk-...value at once. - Store it as an environment variable on your server. Do not put it in browser code or a public repository.
Creating a system access token:
- Open Account settings.
- Open Security settings.
- Generate a system access token and save it immediately.
Regenerating the system access token replaces the previous one. The old value stops working.
Your user ID is on the Account settings page, labeled ID. Account endpoints need that ID in the New-Api-User header.
Base URLs
| Client | Base URL |
|---|---|
| OpenAI-compatible SDKs and HTTP | https://global.beefapi.com/v1 |
| Anthropic SDK and Claude Code | https://global.beefapi.com |
| Account API | https://global.beefapi.com/api |
Point the Anthropic SDK at the host root. It appends /v1/messages itself. OpenAI-compatible clients need /v1 on the base URL.
Authentication
API key
Use this for every model request:
Authorization: Bearer sk-...
Anthropic-compatible calls also accept the Anthropic header:
x-api-key: sk-...
anthropic-version: 2023-06-01
System access token
Use this only for account endpoints:
Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN
New-Api-User: YOUR_USER_ID
New-Api-User must match the user ID that owns the system access token. Both headers are required.
OpenAI-compatible calls
Base URL: https://global.beefapi.com/v1
| Method | Path | Use |
|---|---|---|
POST |
/v1/chat/completions |
Chat Completions |
POST |
/v1/responses |
Responses API |
GET |
/v1/models |
Models your key can call |
Prepaid USD credit pays for each completed model request. Usage appears on the Usage page.
Chat Completions
curl https://global.beefapi.com/v1/chat/completions \
-H "Authorization: Bearer $BEEFAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"messages": [
{"role": "user", "content": "Hello"}
]
}'
The request and response follow the OpenAI Chat Completions shape. Replace gpt-5.6-sol with a model ID that your key can call.
Responses API
Clients that speak the OpenAI Responses API can POST to /v1/responses with the same Authorization: Bearer $BEEFAPI_KEY header. Send model and input.
Streaming
Set "stream": true on the JSON body. The response is Server-Sent Events (text/event-stream) instead of a single JSON object. This applies to Chat Completions, Responses, and Anthropic Messages.
List models
curl https://global.beefapi.com/v1/models \
-H "Authorization: Bearer $BEEFAPI_KEY"
The JSON is an OpenAI-style list (object: list plus a data array of model objects). With a key, the list is the set that key can call. Without a key, GET /v1/models still returns 200 with the public catalog.
Use the exact id string from that list. Public prices for the catalog are on Pricing. Your signed-in account decides which of those IDs you can call.
Anthropic-compatible calls
Set the Anthropic SDK or Claude Code base URL to https://global.beefapi.com. Direct HTTP uses the full path:
curl https://global.beefapi.com/v1/messages \
-H "x-api-key: $BEEFAPI_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 512,
"messages": [
{"role": "user", "content": "Hello"}
]
}'
Use an API key (sk-...) in x-api-key. Include anthropic-version. max_tokens is required by the Anthropic Messages API. Pick a model ID from GET /v1/models for your key.
Streaming uses the same "stream": true field as the OpenAI-compatible endpoints.
Account endpoints
Account endpoints live under https://global.beefapi.com/api. They use the system access token, not the API key.
Check the signed-in account, including remaining credit:
curl https://global.beefapi.com/api/user/self \
-H "Authorization: Bearer $BEEFAPI_ACCESS_TOKEN" \
-H "New-Api-User: $BEEFAPI_USER_ID"
A successful body looks like { "success": true, "data": { ... } }. Useful fields:
| Field | Meaning |
|---|---|
data.id |
User ID (the value for New-Api-User) |
data.quota |
Remaining credit (not a USD amount) |
data.used_quota |
Historical consumption (same units as quota) |
data.request_count |
Request count |
The console shows the USD amount. Billing is the place to add prepaid USD credit. Do not convert quota with a hardcoded rate in your client.
Without a system access token, GET /api/user/self returns 401 with { "success": false, "message": "..." }. That shape is not the model-API error object.
This endpoint reports the account, not a single sk-... key.
Common mistakes
- Using the system access token as
Authorization: Beareron/v1/chat/completionsor/v1/messages. - Using an
sk-...API key on/api/user/self. - Omitting
New-Api-Useron account calls. - Pointing an OpenAI client at
https://global.beefapi.comwithout/v1. - Pointing Claude Code or the Anthropic SDK at
https://global.beefapi.com/v1instead of the host root. - Sending a model ID that is not in
GET /v1/modelsfor that key. That is a404model_not_found. See Errors.