> ## Documentation Index
> Fetch the complete documentation index at: https://docs.requesty.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> One API. 600+ models. OpenAI-compatible. Route your first request in under 2 minutes.

## Switch from OpenAI in 2 lines

If you're already using the OpenAI SDK, point it at Requesty and you're done. No SDK changes, no new client to learn.

```python Python theme={"dark"}
from openai import OpenAI

client = OpenAI(
    api_key="REQUESTY_API_KEY",                       # was: OPENAI_API_KEY
    base_url="https://router.requesty.ai/v1",         # was: https://api.openai.com/v1
    default_headers={
        "HTTP-Referer": "https://yourapp.com",        # Optional - your site URL for analytics
        "X-Title": "My App",                          # Optional - your app name for analytics
    },
)
```

```typescript TypeScript theme={"dark"}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "REQUESTY_API_KEY",                         // was: OPENAI_API_KEY
  baseURL: "https://router.requesty.ai/v1",           // was: https://api.openai.com/v1
  defaultHeaders: {
    "HTTP-Referer": "https://yourapp.com",            // Optional - your site URL for analytics
    "X-Title": "My App",                              // Optional - your app name for analytics
  },
});
```

> [!TIP]
>
> Every SDK and framework that speaks OpenAI (LangChain, Vercel AI SDK, LlamaIndex, Haystack, Pydantic AI) works with Requesty out of the box. Same for the Anthropic SDK against `/anthropic/v1/messages`.

## Three steps to your first request

**1. Get your API key**

Sign up at [app.requesty.ai](https://app.requesty.ai/sign-up) and create a key on the [API Keys page](https://app.requesty.ai/api-keys). You can start for free: [free models](https://docs.requesty.ai/features/free-models.md) need no credit card.

Export it so the snippets below just work:

```bash theme={"dark"}
export REQUESTY_API_KEY="sk-..."
```

**2. Install the SDK**

> [tab] Python
>
> ```bash theme={"dark"}
> pip install openai
> ```

> [tab] TypeScript
>
> ```bash theme={"dark"}
> npm install openai
> ```

> [tab] cURL
>
> No install needed. cURL ships with every major OS.

**3. Make your first request**

```python Python theme={"dark"}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["REQUESTY_API_KEY"],
    base_url="https://router.requesty.ai/v1",
    default_headers={
        "HTTP-Referer": "https://yourapp.com",  # Optional - your site URL
        "X-Title": "My App",                    # Optional - your app name
    },
)

response = client.chat.completions.create(
    model="gpt-6-luna",
    messages=[{"role": "user", "content": "Hello, who are you?"}],
)

print(response.choices[0].message.content)
```

```typescript TypeScript theme={"dark"}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.REQUESTY_API_KEY,
  baseURL: "https://router.requesty.ai/v1",
  defaultHeaders: {
    "HTTP-Referer": "https://yourapp.com",      // Optional - your site URL
    "X-Title": "My App",                        // Optional - your app name
  },
});

const response = await client.chat.completions.create({
  model: "gpt-6-luna",
  messages: [{ role: "user", content: "Hello, who are you?" }],
});

console.log(response.choices[0].message.content);
```

```bash cURL theme={"dark"}
curl https://router.requesty.ai/v1/chat/completions \
  -H "Authorization: Bearer $REQUESTY_API_KEY" \
  -H "HTTP-Referer: https://yourapp.com" \
  -H "X-Title: My App" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "messages": [{"role": "user", "content": "Hello, who are you?"}]
  }'
```

> [accordion] Expected response
>
> Requesty returns an OpenAI-compatible response.
>
> ```json Response body theme={"dark"}
> {
>   "id": "rqsty-cmpl-d08922e2-...",
>   "object": "chat.completion",
>   "created": 1791800949,
>   "model": "gpt-6-luna",
>   "choices": [
>     {
>       "index": 0,
>       "message": {
>         "role": "assistant",
>         "content": "I'm ChatGPT, an AI assistant created by OpenAI."
>       },
>       "finish_reason": "stop"
>     }
>   ],
>   "usage": { "prompt_tokens": 15, "completion_tokens": 17, "total_tokens": 32, "cost": 0.00001 }
> }
> ```
>
> The `usage` object is returned by default on every non-streaming response. The `cost` field is Requesty's USD cost for the call, you don't need to pass any extra parameter to get it. For streaming, opt in with `stream_options: {"include_usage": true}` to receive a final usage chunk. See [Streaming](https://docs.requesty.ai/features/streaming.md#token-usage-and-cost-while-streaming).

> [!TIP]
>
> `gpt-6-luna` is a bare model name, so Requesty picks the best provider for it on every request and fails over if one degrades (a [Managed Policy](https://docs.requesty.ai/features/managed-policies.md)). Use `provider/model`, for example `openai/gpt-6-luna`, to pin a single provider.

> [!NOTE]
>
> The `HTTP-Referer` and `X-Title` headers are **optional** but recommended. Requesty uses them to tag your requests in analytics. `HTTP-Referer` identifies your site URL and `X-Title` gives your app a human-readable name. Both appear in your [analytics dashboards](https://docs.requesty.ai/features/usage-analytics.md) so you can filter traffic by origin.

**4. Make it production-ready (bonus)**

Two upgrades turn this from a toy into something you can ship. Neither requires new infra.

**Add metadata** so every request is attributable in [analytics](https://app.requesty.ai/analytics). Tag by feature, user, or trace ID to slice spend and latency the way you already think about your product.

**Route to a policy** instead of a single model. Create a [Fallback Policy](https://app.requesty.ai/routing-policies) once, then reference it by name. If the primary model errors or times out, Requesty tries the next one. No retry logic in your app.

```python Python theme={"dark"}
response = client.chat.completions.create(
    model="policy/sonnet-with-fallback",  # set up once in the dashboard
    messages=[{"role": "user", "content": "Hello, who are you?"}],
    extra_body={
        "requesty": {
            "tags": ["quickstart", "chat"],
            "user_id": "user_1234",
            "trace_id": "session_abc123",
            "extra": {
                "feature": "onboarding",
                "environment": "production",
            },
        },
    },
)
```

```typescript TypeScript theme={"dark"}
const response = await client.chat.completions.create({
  model: "policy/sonnet-with-fallback", // set up once in the dashboard
  messages: [{ role: "user", content: "Hello, who are you?" }],
  // @ts-expect-error Requesty extends the OpenAI schema
  requesty: {
    tags: ["quickstart", "chat"],
    user_id: "user_1234",
    trace_id: "session_abc123",
    extra: {
      feature: "onboarding",
      environment: "production",
    },
  },
});
```

```bash cURL theme={"dark"}
curl https://router.requesty.ai/v1/chat/completions \
  -H "Authorization: Bearer $REQUESTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "policy/sonnet-with-fallback",
    "messages": [{"role": "user", "content": "Hello, who are you?"}],
    "requesty": {
      "tags": ["quickstart", "chat"],
      "user_id": "user_1234",
      "trace_id": "session_abc123",
      "extra": { "feature": "onboarding", "environment": "production" }
    }
  }'
```

Learn more: [Request Metadata](https://docs.requesty.ai/features/request-metadata.md) · [Fallback Policies](https://docs.requesty.ai/features/fallback-policies.md) · [Load Balancing](https://docs.requesty.ai/features/load-balancing-policies.md) · [Latency Routing](https://docs.requesty.ai/features/latency-routing.md).

## Pick a model

Every model lives behind one endpoint. Swap `model` in the request to switch providers. No other code changes, no new SDK, no new auth.

> [card] [Frontier](https://app.requesty.ai/model-library)
>
> Claude Fable & Opus, GPT Astra & Sol. For the hardest tasks.

> [card] [Fast & cheap](https://app.requesty.ai/model-library)
>
> Claude Haiku, GPT Luna, Gemini Flash. Low latency, low cost.

> [card] [Open source](https://app.requesty.ai/model-library)
>
> DeepSeek, Mistral, GLM, Qwen. Served by multiple providers.

## What Requesty adds on top

> [card] [Smart routing](https://docs.requesty.ai/features/fallback-policies.md)
>
> Fallbacks, load balancing, and latency routing across 30+ providers. When one degrades, traffic moves automatically.

> [card] [Auto-caching](https://docs.requesty.ai/features/auto-caching.md)
>
> Cut costs up to 80% on repeated prompts with zero configuration.

> [card] [Usage analytics](https://docs.requesty.ai/features/usage-analytics.md)
>
> Track spend, latency, and errors per key, user, model, or project.

> [card] [Spend management](https://docs.requesty.ai/features/api-limits.md)
>
> Budgets per team, user, and API key, alerts before limits hit, and spend analytics for every dollar.

> [card] [Bring your own keys](https://docs.requesty.ai/features/bring-your-own-keys.md)
>
> Use your own provider accounts and keep existing pricing.

> [card] [Guardrails & RBAC](https://docs.requesty.ai/features/guardrails.md)
>
> Content filtering, approved-model lists, and role-based access.

## Use your favorite harness

Coding agents, desktop agents, and chat platforms connect to Requesty with a base URL and an API key. These are the harnesses teams use most on Requesty. The [Requesty CLI](https://docs.requesty.ai/integrations/requesty-cli.md) sets most of them up in one command.

> [card] [Claude Code](https://docs.requesty.ai/integrations/claude-code.md)

> [card] [Codex](https://docs.requesty.ai/integrations/openai-codex.md)

> [card] [Cursor](https://docs.requesty.ai/integrations/cursor.md)

> [card] [Hermes Agent](https://docs.requesty.ai/integrations/hermes.md)

> [card] [OpenCode](https://docs.requesty.ai/integrations/opencode.md)

> [card] [Pi](https://docs.requesty.ai/integrations/pi.md)

> [card] [DS Harness](https://docs.requesty.ai/integrations/deepseek-harness.md)

> [card] [GitHub Copilot](https://docs.requesty.ai/integrations/github-copilot.md)

Also on Requesty: [Claude Cowork](https://docs.requesty.ai/integrations/claude-cowork.md) and [OpenClaw](https://docs.requesty.ai/integrations/openclaw.md) for desktop agents, and [Open WebUI](https://docs.requesty.ai/integrations/openwebui.md), [LibreChat](https://docs.requesty.ai/integrations/librechat.md), and [Langdock](https://docs.requesty.ai/integrations/langdock.md) for chat.

## Use your favorite framework

> [card] [LangChain](https://docs.requesty.ai/frameworks/langchain.md)

> [card] [Vercel AI SDK](https://docs.requesty.ai/frameworks/vercel-ai-sdk.md)

> [card] [LlamaIndex](https://docs.requesty.ai/frameworks/llamaindex-ts.md)

> [card] [Haystack](https://docs.requesty.ai/frameworks/haystack.md)

> [card] [Pydantic AI](https://docs.requesty.ai/frameworks/pydantic-ai.md)

> [card] [Axios](https://docs.requesty.ai/frameworks/axios.md)

> [card] [Requests](https://docs.requesty.ai/frameworks/requests.md)

> [card] [Anthropic SDK](https://docs.requesty.ai/integrations/anthropic-agent-sdks.md)

## Common questions

> [accordion] How is Requesty different from calling providers directly?
>
> Calling a provider directly gives you one provider's models, one auth method, and one point of failure. Requesty gives you one endpoint across 600+ models from 30+ providers, with automatic failover, caching, budgets, unified analytics, and one bill.

> [accordion] What does Requesty cost?
>
> You pay the provider's token prices, and a 5% service fee is added when you top up credits. Every request shows its exact cost in the [analytics dashboard](https://app.requesty.ai/analytics) and in the `usage.cost` field of the response. See [Billing](https://docs.requesty.ai/features/billing.md) for payment methods and auto top-up.

> [accordion] Can I try Requesty for free?
>
> Yes. [Free models](https://docs.requesty.ai/features/free-models.md) need no credit card and come with 200 requests per day, with the same routing, logs, and analytics as paid models.

> [accordion] Should I use a bare model name or provider/model?
>
> A bare name like `deepseek-v4.1-flash` is a [Managed Policy](https://docs.requesty.ai/features/managed-policies.md): Requesty picks the best provider on every request and fails over when one degrades. Use `provider/model`, like `deepseek/deepseek-v4.1-flash`, to pin one provider, or `policy/your-policy` to use a [routing policy](https://docs.requesty.ai/features/fallback-policies.md) you created.

> [accordion] Is my data used for training?
>
> No. Requesty is a pass-through gateway and does not train on your requests or responses. Each model's retention and training policy is shown in the [Model Library](https://app.requesty.ai/model-library), and [Data Privacy](https://docs.requesty.ai/features/data-privacy.md) covers what Requesty stores.

> [accordion] Can I keep my data in the EU?
>
> Yes. Use `https://router.eu.requesty.ai/v1` so Requesty processes and stores your traffic in Frankfurt, and use EU-hosted models (for example `@eu` variants) so inference stays in the EU too. See [EU Routing](https://docs.requesty.ai/features/eu-routing.md).

> [accordion] Which Anthropic SDK endpoint do I use?
>
> Point the Anthropic SDK at `https://router.requesty.ai/anthropic/v1/messages`. See the [Anthropic Agent SDKs guide](https://docs.requesty.ai/integrations/anthropic-agent-sdks.md) for code samples.

## Next steps

> [card] [Inference APIs](https://docs.requesty.ai/api-reference/inference-apis.md)
>
> Chat completions, embeddings, audio, images, and model listing endpoints.

> [card] [Management APIs](https://docs.requesty.ai/api-reference/management-apis.md)
>
> Programmatically manage API keys, groups, members, and organization settings.

> [card] [Use with Claude Code](https://docs.requesty.ai/integrations/claude-code.md)
>
> Point Claude Code at Requesty for unified billing and routing.

> [card] [Configure routing](https://docs.requesty.ai/features/fallback-policies.md)
>
> Set up fallbacks, load balancing, and latency-aware routing.

> [card] [EU Routing](https://docs.requesty.ai/features/eu-routing.md)
>
> Keep processing, storage, and inference in the EU with the Frankfurt endpoint and EU-hosted models.

> [card] [Join the community](https://discord.com/invite/Td3rwAHgt4)
>
> Ask questions, share builds, and meet the team on Discord.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.