Docs

API Access

Prepare an AnyPath API key, base URL, and production request path.

On this page
  1. 1. Create an API key
  2. 2. Pick the base URL
  3. 3. Discover available models
  4. 4. Send a gateway request
  5. Production checklist
  6. Next

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

ProtocolBase URLMain endpoints
OpenAI-compatiblehttps://api.anypath.dev/v1/models, /chat/completions, /responses, /images/*
Anthropic Messageshttps://api.anypath.dev/v1/messages, /v1/messages/count_tokens
Gemini /v1betahttps://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/models before saving model configuration.
  • Set explicit request timeouts and output limits.
  • Retry only temporary failures such as 429, 502, 503, and 504; respect Retry-After when present.
  • Check Console pricing, shared-route balance, and key usage limits before sending production traffic.
  • Shared routes settle after successful requests.

Next

Quickstart covers the 5‑minute caller path (key → base URL → first request). The Supplier guide covers connecting provider credentials and earning from them.