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

# LLM Quickstart

Sunra provides four LLM API endpoints for text generation and embeddings. They use the same authentication and base URL (`https://api-llm.sunra.ai`), so you can pick the format that fits your stack.

Before diving in, grab an API key from your [dashboard](https://sunra.ai/dashboard/api-tokens).

Use canonical model IDs in requests. Sunra selects a provider automatically when `provider` is omitted; see [Provider routing](/llm/provider-routing) when you need to choose or prioritize providers.

## Chat Completions — `/v1/chat/completions`

The [Chat Completions](/llm/chat) endpoint follows the **OpenAI Chat Completions** format. It accepts a list of messages with roles (`system`, `user`, `assistant`) and returns a completion.

Use this endpoint when you want drop-in compatibility with OpenAI SDKs and tooling.

**Key features:** streaming, function calling, vision (images, audio, video, files), reasoning, structured outputs (JSON schema / grammar), logprobs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/chat/completions \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "What is the capital of France?" }
    ]
  }'
```

## Anthropic Messages — `/v1/messages`

The [Anthropic Messages](/llm/messages) endpoint follows the **Anthropic Messages API** format. It uses `user` / `assistant` message roles with rich content blocks and a separate `system` parameter.

Use this endpoint when you want native access to Anthropic Claude models and features like extended thinking, prompt caching, citations, and built-in tools (web search, code execution).

**Key features:** streaming, extended thinking, prompt caching, tool use (custom + built-in), PDF/document input, citations, structured outputs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/messages \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Hello, how are you?" }
    ]
  }'
```

## Responses — `/v1/responses`

The [Responses](/llm/responses) endpoint follows the **OpenAI Responses API** format. It accepts flexible input items (messages, function calls, reasoning) and returns structured output items.

Use this endpoint when you need the latest OpenAI Responses features like built-in web search, file search, code interpreter, computer use, MCP tool integration, or image generation.

**Key features:** streaming, function calling, web search, file search, code interpreter, computer use, MCP tools, image generation, reasoning, structured outputs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/responses \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "input": [
      { "type": "message", "role": "user", "content": "Hello, how are you?" }
    ]
  }'
```

## Embeddings — `/v1/embeddings`

The [Embeddings](/llm/embeddings) endpoint follows the **OpenAI Embeddings** format. It creates vectors from text and supported media inputs for retrieval, semantic search, clustering, classification, and RAG.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/embeddings \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-embedding-2",
    "input": "Sunra provides one API for AI models."
  }'
```

## Choosing the right endpoint

|                       | Chat Completions         | Anthropic Messages         | Responses                                                    | Embeddings             |
| --------------------- | ------------------------ | -------------------------- | ------------------------------------------------------------ | ---------------------- |
| **Format**            | OpenAI Chat              | Anthropic Messages         | OpenAI Responses                                             | OpenAI Embeddings      |
| **Best for**          | OpenAI SDK compatibility | Claude-native features     | Latest OpenAI features                                       | Search and RAG vectors |
| **Streaming**         | SSE                      | SSE                        | SSE                                                          | No                     |
| **Function calling**  | Yes                      | Yes (custom + built-in)    | Yes                                                          | No                     |
| **Reasoning**         | Yes                      | Extended thinking          | Yes                                                          | No                     |
| **Structured output** | JSON schema, grammar     | JSON schema                | JSON schema                                                  | Vectors                |
| **Built-in tools**    | —                        | Web search, code execution | Web search, file search, code interpreter, computer use, MCP | —                      |

All four endpoints share the same authentication. Pass your API key as a Bearer token in the `Authorization` header.
