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

# Completions

> The basic gateway call: send messages, pick a model, get a response.

The simplest gateway call: a list of messages goes in, a single response comes out. Same shape every model supports.

If you haven't set up your SDK yet, start with [Drop-in SDKs](/build/gateway/drop-in-sdks).

## A minimal call

<CodeGroup>
  ```python Python theme={null}
  import os
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.opper.ai/v3/compat",
      api_key=os.environ["OPPER_API_KEY"],
  )

  r = client.chat.completions.create(
      model="openai/gpt-5-mini",
      messages=[{"role": "user", "content": "What's a vector?"}],
  )
  print(r.choices[0].message.content)
  ```

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

  const client = new OpenAI({
      baseURL: "https://api.opper.ai/v3/compat",
      apiKey: process.env.OPPER_API_KEY!,
  });

  const r = await client.chat.completions.create({
      model: "openai/gpt-5-mini",
      messages: [{ role: "user", content: "What's a vector?" }],
  });
  console.log(r.choices[0].message.content);
  ```

  ```bash cURL theme={null}
  curl https://api.opper.ai/v3/compat/chat/completions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPPER_API_KEY" \
    -d '{
      "model": "openai/gpt-5-mini",
      "messages": [{"role": "user", "content": "What'\''s a vector?"}]
    }'
  ```
</CodeGroup>

## Pick a model

The `model` field is always provider-prefixed: `openai/gpt-5.5`, `anthropic/claude-sonnet-4-6`, `gemini/gemini-2.5-pro`. Browse the full set on the [Models](/capabilities/models) page.

You can call any model from any SDK. The Anthropic SDK can talk to a Google model, the OpenAI SDK can talk to a Claude model. The provider prefix decides where the call routes. The SDK only sets the request shape.

If you don't pass `model`, the call falls through to your [Route](/control-plane/route) rule, which sets a default model per project so you can keep model names out of your code.

## Common parameters

| Parameter                                | What it does                                                             |
| ---------------------------------------- | ------------------------------------------------------------------------ |
| `temperature`                            | 0 to 2. Lower is more deterministic.                                     |
| `top_p`                                  | 0 to 1. Nucleus sampling. Don't use with `temperature` at the same time. |
| `max_tokens`                             | Cap the response length.                                                 |
| `stop`                                   | A string or array of strings. The model stops as soon as it sees one.    |
| `frequency_penalty` / `presence_penalty` | -2 to 2. Penalize repeated tokens.                                       |
| `n`                                      | How many response choices to generate. Default 1.                        |

Reasoning models (the GPT-5 family, Claude with extended thinking) also accept `reasoning_effort: "low" | "medium" | "high"` to control how much the model "thinks" before answering.

## The response shape

```json Response theme={null}
{
  "id": "chatcmpl_...",
  "object": "chat.completion",
  "model": "openai/gpt-5-mini",
  "created": 1716124800,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A vector is..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 11,
    "completion_tokens": 42,
    "total_tokens": 53
  }
}
```

The two things you'll read most:

* `choices[0].message.content` is the assistant's reply
* `choices[0].finish_reason` is why the model stopped (`stop`, `length`, `tool_calls`, `content_filter`)

## What's next

<CardGroup cols={2}>
  <Card title="Conversations" icon="comments" href="/build/gateway/conversations">
    Multi-turn chat with message history.
  </Card>

  <Card title="Tool calling" icon="screwdriver-wrench" href="/build/gateway/tools">
    Let the model call your code.
  </Card>

  <Card title="Streaming" icon="bolt-lightning" href="/build/gateway/streaming">
    Stream tokens as they're generated.
  </Card>

  <Card title="Structured output" icon="braces" href="/build/gateway/structured-output">
    Get JSON back instead of free text.
  </Card>
</CardGroup>
