Start here
Make your first request
Install the OpenAI SDK or call the HTTP endpoint directly. Existing OpenAI-compatible clients only need a new API key and base URL.
curl https://apicredits.site/v1/chat/completions \
-H "Authorization: Bearer $APICREDITS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"messages": [
{"role": "user", "content": "Explain vector databases in one paragraph."}
]
}'SDK setup: npm install openai or pip install openai. Keep the key in an environment variable and never expose it in browser code.
Security
Authentication
Every API request must include your ApiCredits key. The recommended scheme is an Authorization bearer token.
Bearer token
Recommended for OpenAI-compatible clients.
HEADER
x-api-keyAccepted by Anthropic-compatible clients.
HEADER
x-goog-api-keyAccepted by Gemini-compatible clients.
Authorization: Bearer $APICREDITS_API_KEYCatalog
Models
Fetch the current catalog at runtime before selecting a model. Model IDs are case-sensitive and must be sent exactly as returned.
/v1/modelsReturns the models available to the authenticated API key.
curl https://apicredits.site/v1/models \
-H "Authorization: Bearer $APICREDITS_API_KEY"OpenAI
6 modelsgpt-5.6-solgpt-5.6-lunagpt-5.6-terragpt-5.5gpt-5.4gpt-5.4-mini
Anthropic
7 modelsclaude-fable-5claude-opus-4-8claude-opus-4-7claude-opus-4-6claude-sonnet-5claude-sonnet-4-6claude-haiku-4-5
xAI
2 modelsgrok-4.5grok-4.3
DeepSeek
2 modelsdeepseek-v4-prodeepseek-v4-flash
Zhipu
2 modelsglm-5.1glm-5.2
gemini-3.1-pro-previewgemini-3-pro-previewgemini-2.5-flash
Availability can depend on the API key configuration. The authenticated /v1/models response is authoritative.
OpenAI compatible
Chat Completions
Use the familiar messages array for standard text conversations, tools, structured prompts, and streaming output.
/v1/chat/completionsCreates a model response from an ordered conversation.
curl https://apicredits.site/v1/chat/completions \
-H "Authorization: Bearer $APICREDITS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [
{"role": "system", "content": "You are a concise technical assistant."},
{"role": "user", "content": "Write a PostgreSQL health-check query."}
],
"stream": false
}'| Field | Required | Description |
|---|---|---|
model | Yes | A model ID returned by /v1/models. |
messages | Yes | Ordered system, user, assistant, and tool messages. |
stream | No | Set true to receive server-sent events. |
temperature | No | Sampling control; support and range are model-dependent. |
max_tokens | No | Maximum generated tokens, subject to model limits. |
tools | No | Tool definitions for models that support tool calling. |
OpenAI compatible
Responses API
Use Responses for a unified input format, instructions, tools, and modern OpenAI SDK workflows.
/v1/responsesCreates a response from text input or structured conversation items.
curl https://apicredits.site/v1/responses \
-H "Authorization: Bearer $APICREDITS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"instructions": "Answer as a senior backend engineer.",
"input": "Explain idempotent payment fulfillment.",
"stream": false
}'Anthropic compatible
Messages API
Use the Anthropic request format for Claude-oriented applications and tools that expect the Messages protocol.
/v1/messagesCreates a response using the Anthropic Messages format.
/v1/messages/count_tokensCounts request tokens when supported by the selected route.
curl https://apicredits.site/v1/messages \
-H "x-api-key: $APICREDITS_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-fable-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Create a migration checklist."}
]
}'Google compatible
Gemini native API
Gemini SDK-compatible text requests use the v1beta route and a Google-style API key header.
/v1beta/models/{model}:generateContentGenerates text with the native Gemini contents format.
curl "https://apicredits.site/v1beta/models/gemini-2.5-flash:generateContent" \
-H "x-goog-api-key: $APICREDITS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{"role": "user", "parts": [{"text": "Summarize zero-downtime deployments."}]}
]
}'Real time
Streaming
Set stream to true to receive incremental server-sent events. Keep the connection open until the protocol-specific completion event arrives.
curl -N https://apicredits.site/v1/chat/completions \
-H "Authorization: Bearer $APICREDITS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{"role": "user", "content": "Give me five API reliability checks."}],
"stream": true
}'- Parse each SSE
data:frame independently. - Use a read timeout long enough for model generation.
- Do not retry after content has already been emitted.
- Handle the error shape of the selected API protocol.
Wallet
Usage and balance
Inspect the authenticated key's validity, wallet balance, request totals, token usage, and model statistics.
/v1/usageReturns balance and usage information for the current API key.
curl "https://apicredits.site/v1/usage?days=30" \
-H "Authorization: Bearer $APICREDITS_API_KEY"Optional query parameters include days from 1 to 90, plus start_date and end_date in YYYY-MM-DD format for model statistics.
Reliability
Errors and retries
HTTP status codes communicate the failure class. Error bodies follow the OpenAI, Anthropic, or Google-compatible shape used by the endpoint.
| Status | Meaning | Action |
|---|---|---|
400 | Invalid request | Validate JSON, model, messages, and field types. |
401 | Authentication failed | Check the API key and authentication header. |
402 | Billing unavailable | Top up the wallet or review the key's quota. |
403 | Request not permitted | Check key restrictions and endpoint access. |
404 | Route or model unavailable | Refresh /v1/models and verify the endpoint path. |
429 | Rate or concurrency limit | Retry with exponential backoff and jitter. |
500 | Internal error | Retry once; contact support if the error repeats. |
502 / 503 | Upstream unavailable | Retry with backoff or use a fallback model. |
x-request-id response header when contacting support. Never send your full API key in a support message.Ready to connect?
Choose a wallet plan, then use the delivered key with these endpoints.