Every frontier model, five minutes away
APIArc brings models from different providers behind one API endpoint. Keep the OpenAI SDK you already know—change the base URL, API key, and model ID.
The shortest path
Already using the OpenAI SDK? You only need these three changes.
Create a key
Generate an API key in the console
Change the endpoint
Point the base URL at APIArc
Choose a model
Copy a model ID from the catalog
Make your first request
This example uses the Chat Completions protocol. It works with common OpenAI clients and quickly verifies your key, network, and model access.
Create an API key
Sign in, open API keys, and create a key. The full value is shown once, so store it safely before closing the window.
Create an API keySet an environment variable
Keep the key in your server environment. Never commit it to Git or include it in browser code.
export APIARC_API_KEY="your_api_key_here"Send the request
Run any example below. It sends a short greeting to DeepSeek Chat.
curl https://api.apiarc.dev/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $APIARC_API_KEY" \
-d '{
"model": "deepseek-chat",
"messages": [
{"role": "user", "content": "Say hello in one sentence."}
]
}'Successful response: The HTTP status is 200 and the model text is returned in choices[0].message.content.
Every request uses a bearer token
APIArc uses the API key to identify your project and meter usage. Put it in the Authorization header; no extra request signing is required.
Authorization: Bearer $APIARC_API_KEYA key carries your account permissions
Anyone with the key can spend your balance. If it appears in logs, screenshots, or a public repository, revoke and replace it immediately.
- Read keys from server-side environment variables, never from the browser.
- Use a separate key per app or environment so usage and revocation stay isolated.
- Rotate production keys by deploying the new key before revoking the old one.
One base URL, several compatible protocols
Chat Completions is enough for most applications. When you need native capabilities, use the Responses, Anthropic Messages, or Gemini generateContent protocol supported by the model.
https://api.apiarc.dev| Endpoint | Purpose | Best for |
|---|---|---|
| /v1/chat/completions | Multi-turn text and tool calls | Existing OpenAI-compatible apps |
| /v1/responses | OpenAI Responses protocol | Native Responses capabilities |
| /v1/messages | Anthropic Messages protocol | Native Claude clients |
| /v1/models | List available models | Dynamic selection and health checks |
Compatibility does not make every model identical
The request shape can be unified while context length, tool use, image input, and structured output still vary by model. Confirm capabilities and pricing on the model page before shipping.
Switch models by changing one string
The model field chooses the model that handles the request. The endpoint, authentication, and response parsing stay the same, so one integration can compare several providers.
deepseek-chatThe catalog changes over time. Copy the exact ID shown on the model page instead of guessing it from the display name.
Production recommendation
Establish a quality and cost baseline for your primary model, then test a backup that uses the same protocol. You can switch quickly during a provider incident without changing business logic.
Show the first token sooner
Add stream: true to the request body. APIArc forwards upstream output as Server-Sent Events (SSE) as it arrives.
const stream = await client.chat.completions.create({
model: "deepseek-chat",
messages: [{ role: "user", content: "Explain API gateways." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Read each data: event, append its content delta, and finish when [DONE] arrives. If the connection breaks, do not store the partial answer as a complete result.
Separate fixable errors from retryable failures
Start with the HTTP status, then record the error message and request ID. Fix client configuration errors immediately; retry brief network or upstream failures with backoff.
| Status | Common cause | Recommended action |
|---|---|---|
| 400 | Invalid field or model ID | Fix the request; do not retry unchanged |
| 401 | Missing, invalid, or revoked key | Check the Authorization header |
| 402 | Insufficient account balance | Add credits before retrying |
| 429 | Rate or quota exceeded | Back off exponentially and reduce concurrency |
| 5xx | Gateway or upstream unavailable | Retry after a short backoff or switch models |
Keep the request ID
When contacting support, provide the request ID, time, model, and endpoint. Never send an API key, full prompt, or payment information.
Production checklist
One successful request proves the integration works. Shipping also requires clear boundaries for timeouts, retries, credentials, and cost.
Set timeouts
Limit both connection time and total generation time.
Retry carefully
Retry only 429, network errors, and selected 5xx responses with exponential backoff.
Protect keys
Store keys only in server-side secret managers or environment variables.
Log request IDs
Keep model, latency, status, and request ID without logging sensitive content.
Watch spend
Review usage by key and model, and alert on unexpected consumption.
Plan a fallback
Test a backup model and a non-streaming path for critical traffic.
Ready to make your first request?
Create a key, then copy a model ID from the catalog.