API Access
Prepare an AnyPath API key, base URL, and production request path.
On this page
1. Create an API key
Sign in at anypath.dev, open Console -> API access, and create a key. Copy it immediately because the full secret is shown only once.
Keep the default intelligent route policy to route across eligible healthy shared capacity automatically. A route is one saved provider credential plus the models it serves; the key’s route policy decides whether AnyPath picks routes automatically (intelligent routing) or stays inside one provider (specified provider) — still not tied to one provider key. New to routes, providers, and multipliers? See Concepts.
Keep API keys in server-side secrets only. Do not expose them in browsers, mobile apps, public repositories, logs, or screenshots.
2. Pick the base URL
| Protocol | Base URL | Main endpoints |
|---|---|---|
| OpenAI-compatible | https://api.anypath.dev/v1 | /models, /chat/completions, /responses, /images/* |
| Anthropic Messages | https://api.anypath.dev | /v1/messages, /v1/messages/count_tokens |
Gemini /v1beta | https://api.anypath.dev/v1beta | /models, /models/{model}:generateContent, /models/{model}:streamGenerateContent, /models/{model}:countTokens |
3. Discover available models
curl https://api.anypath.dev/v1/models \
-H "Authorization: Bearer sk-your-api-key"
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.anypath.dev/v1",
)
models = client.models.list()
for m in models.data:
print(m.id)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-api-key",
baseURL: "https://api.anypath.dev/v1",
});
const models = await client.models.list();
models.data.forEach((m) => console.log(m.id));
The response only includes models available to that API key and route policy. Use this result as the source for model pickers and saved configuration.
4. Send a gateway request
curl https://api.anypath.dev/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "user", "content": "Summarize the attached support case in one paragraph."}
],
"max_tokens": 300
}'
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Summarize the attached support case in one paragraph."}],
max_tokens=300,
)
print(response.choices[0].message.content)
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Summarize the attached support case in one paragraph." }],
max_tokens: 300,
});
console.log(response.choices[0].message.content);
Use POST /v1/responses, /v1/messages, or Gemini /v1beta only when the client needs that protocol shape.
Production checklist
- Call
GET /v1/modelsbefore saving model configuration. - Set explicit request timeouts and output limits.
- Retry only temporary failures such as
429,502,503, and504; respectRetry-Afterwhen present. - Check Console pricing, shared-route balance, and key usage limits before sending production traffic.
- Shared routes settle after successful requests.
Next
- Authentication: supported auth headers.
- API Overview: endpoint reference.
- Pricing and billing: how the price is set and what you are charged.
- Supplier guide: connect official capacity and earn USDT.
Quickstart covers the 5‑minute caller path (key → base URL → first request). The Supplier guide covers connecting provider credentials and earning from them.