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

# Yelu AI API documentation

> Build with one OpenAI-compatible API for chat, responses, images, embeddings, audio, vision, streaming, and tool calling.

<Info>
  Yelu AI API is an OpenAI-compatible gateway. Keep your existing OpenAI SDK and request shape, change the base URL, and access models from multiple providers through one API.
</Info>

## One API for production AI

Yelu normalizes authentication, routing, streaming, usage data, and errors across supported model providers. Model availability is tied to your account and can be discovered at runtime with [`GET /v1/models`](/en/api-reference/models).

<CardGroup cols={2}>
  <Card title="Make your first request" icon="rocket" href="/en/quickstart">
    Send a chat request in a few minutes with curl, JavaScript, or Python.
  </Card>

  <Card title="Use the OpenAI SDK" icon="code" href="/en/sdk/python">
    Point the official SDK at `https://api.yelu.ai/v1` and keep its typed API.
  </Card>

  <Card title="Explore the API" icon="braces" href="/en/api-reference/chat-completions">
    Review endpoints, fields, responses, errors, and runnable request examples.
  </Card>

  <Card title="Build robust integrations" icon="shield-check" href="/en/guides/best-practices">
    Apply timeouts, retries, observability, model discovery, and safe key handling.
  </Card>
</CardGroup>

## Coding agents

<CardGroup cols={2}>
  <Card title="Use Claude Code" icon="bot" href="/en/guides/claude-code">
    Configure Anthropic Messages routing on macOS, Windows, or WSL 2.
  </Card>

  <Card title="Use Codex CLI" icon="terminal" href="/en/guides/codex-cli">
    Connect Codex to Yelu's Responses API with a custom model provider.
  </Card>
</CardGroup>

## Core capabilities

<Columns cols={3}>
  <Card title="Text" icon="message">
    Chat Completions and the Responses API with conversation context and reasoning controls.
  </Card>

  <Card title="Multimodal" icon="image">
    Vision input, image generation, audio transcription, and multimodal responses.
  </Card>

  <Card title="Agentic" icon="wrench">
    Function calling, tool choice, structured JSON, streaming, and multi-step workflows.
  </Card>
</Columns>

## Base URL

All OpenAI-compatible endpoints use this base URL:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
https://api.yelu.ai/v1
```

<Warning>
  Keep API keys on a trusted server. Never expose a Yelu key in browser code, public repositories, mobile binaries, or client-side logs.
</Warning>

## First request

Set your key once, then send a request. Replace the example model with an ID returned by [`GET /v1/models`](/en/api-reference/models) if it is not enabled for your account.

<CodeGroup>
  ```bash Curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
  export YELU_API_KEY="your_api_key"

  curl https://api.yelu.ai/v1/chat/completions \
    -H "Authorization: Bearer $YELU_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-4o-mini",
      "messages": [
        {"role": "user", "content": "What makes an API reliable?"}
      ]
    }'
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch('https://api.yelu.ai/v1/chat/completions', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.YELU_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'gpt-4o-mini',
      messages: [{ role: 'user', content: 'What makes an API reliable?' }],
    }),
  });

  if (!response.ok) throw new Error(await response.text());
  console.log((await response.json()).choices[0].message.content);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  import requests

  response = requests.post(
      "https://api.yelu.ai/v1/chat/completions",
      headers={"Authorization": f"Bearer {os.environ['YELU_API_KEY']}"},
      json={
          "model": "gpt-4o-mini",
          "messages": [{"role": "user", "content": "What makes an API reliable?"}],
      },
      timeout=60,
  )
  response.raise_for_status()
  print(response.json()["choices"][0]["message"]["content"])
  ```
</CodeGroup>

## Where to go next

<Steps>
  <Step title="Create and protect a key">
    Follow [Authentication](/en/authentication) and load the key from an environment variable or secret manager.
  </Step>

  <Step title="Discover models">
    Call [List models](/en/api-reference/models) instead of hard-coding a provider catalog.
  </Step>

  <Step title="Choose an API">
    Start new agentic workflows with [Responses](/en/api-reference/responses), or use [Chat Completions](/en/api-reference/chat-completions) for broad OpenAI compatibility.
  </Step>

  <Step title="Prepare for production">
    Read [Rate limits](/en/rate-limits), [Errors](/en/errors), and [Best practices](/en/guides/best-practices).
  </Step>
</Steps>
