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

# Call and choose models

> Use a Planck API key to discover models, filter by capability, make a request, and read the response.

This guide covers the complete path from an API key to a usable model response. It uses the OpenAI-compatible route first, then shows the equivalent Anthropic SDK setup.

## Before you begin

Create a Planck API key from [API Keys](https://us.inquantum.ai/settings/api-keys), then load it as a server-side environment variable:

```bash theme={null}
export PLANCK_API_KEY="sk-planck-..."
```

<Warning>
  Keep this key in a server-side secret store. Never place it in browser code, a
  `NEXT_PUBLIC_*` variable, a mobile application bundle, or a public Git
  repository.
</Warning>

## 1. List the models available to you

`GET /v1/models` is authenticated and returns models accessible with your credentials, Planck credit availability, and organization policy.

```bash theme={null}
curl -s https://api.inquantum.ai/v1/models \
  -H "Authorization: Bearer $PLANCK_API_KEY" | \
  jq -r '.data[] | [.id, (.operations | join(",")), .hasPtb, .hasByok] | @tsv'
```

Each model contains provider-specific `endpoints`. Capabilities can differ between endpoints offering the same model, so check one endpoint satisfies all of your requirements together.

## 2. Filter by your use case

### Models with chat and image input

```bash theme={null}
curl -s https://api.inquantum.ai/v1/models \
  -H "Authorization: Bearer $PLANCK_API_KEY" | \
  jq -r '.data[]
    | select((.operations | index("chat_completions")) != null)
    | select((.inputModalities | index("image")) != null)
    | .id'
```

### Models with tools and streaming on one endpoint

```bash theme={null}
curl -s https://api.inquantum.ai/v1/models \
  -H "Authorization: Bearer $PLANCK_API_KEY" | \
  jq -r '.data[]
    | select(any(.endpoints[];
        ((.supportedOperations | index("chat_completions")) != null) and
        ((.supportedParameters | index("tools")) != null) and
        ((.supportedParameters | index("stream")) != null)))
    | .id'
```

### Reasoning models available with Planck credits

```bash theme={null}
curl -s https://api.inquantum.ai/v1/models \
  -H "Authorization: Bearer $PLANCK_API_KEY" | \
  jq -r '.data[]
    | select(.supportsReasoningEffort and .hasPtb)
    | .id'
```

### Models available through a specific provider

```bash theme={null}
curl -s https://api.inquantum.ai/v1/models \
  -H "Authorization: Bearer $PLANCK_API_KEY" | \
  jq -r '.data[]
    | select(any(.endpoints[]; .provider == "groq" and (.hasPtb or .hasByok)))
    | .id'
```

See [Model capabilities](/gateway/model-capabilities) for every discovery field and the provider-specific `parameterContract`.

## 3. Call the selected model

The request format does not determine the provider. You can use an OpenAI-compatible client to call supported Claude, Gemini, Qwen, and other models through Planck.

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.inquantum.ai/v1/chat/completions \
      -H "Authorization: Bearer $PLANCK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "gpt-4o-mini",
        "messages": [
          {"role": "system", "content": "Answer clearly and concisely."},
          {"role": "user", "content": "Explain vector search in one sentence."}
        ]
      }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os
    from openai import OpenAI

    client = OpenAI(
        api_key=os.environ["PLANCK_API_KEY"],
        base_url="https://api.inquantum.ai/v1",
    )

    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": "Answer clearly and concisely."},
            {"role": "user", "content": "Explain vector search in one sentence."},
        ],
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    import OpenAI from "openai";

    const client = new OpenAI({
      apiKey: process.env.PLANCK_API_KEY,
      baseURL: "https://api.inquantum.ai/v1",
    });

    const response = await client.chat.completions.create({
      model: "gpt-4o-mini",
      messages: [
        { role: "system", content: "Answer clearly and concisely." },
        { role: "user", content: "Explain vector search in one sentence." },
      ],
    });

    console.log(response.choices[0].message.content);
    ```
  </Tab>

  <Tab title="Anthropic SDK">
    ```python theme={null}
    import os
    from anthropic import Anthropic

    client = Anthropic(
        api_key=os.environ["PLANCK_API_KEY"],
        base_url="https://api.inquantum.ai/anthropic",
    )

    message = client.messages.create(
        model="gpt-4o-mini",
        max_tokens=256,
        system="Answer clearly and concisely.",
        messages=[
            {"role": "user", "content": "Explain vector search in one sentence."}
        ],
    )

    for block in message.content:
        if block.type == "text":
            print(block.text)
    ```

    The Anthropic SDK appends `/v1/messages` to the base URL. Its `api_key` option must contain your actual Planck API key. Anthropic-compatible Messages requests require `max_tokens`.
  </Tab>
</Tabs>

To lock the request to one endpoint, prefix the model with the provider—for example, `groq/qwen/qwen3.8-27b`. Leave the prefix off to let Planck select an accessible endpoint.

## 4. Read the response

An OpenAI-compatible non-streaming response has this shape:

```json theme={null}
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "model": "gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Vector search finds records whose embeddings are closest in meaning to a query embedding."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 17,
    "total_tokens": 41,
    "cost_usd": 0.00002
  }
}
```

| What you need                           | OpenAI-compatible location                                                 |
| --------------------------------------- | -------------------------------------------------------------------------- |
| Assistant text                          | `choices[0].message.content`                                               |
| Why generation stopped                  | `choices[0].finish_reason`                                                 |
| Tool requests                           | `choices[0].message.tool_calls`                                            |
| Reasoning, when requested and supported | `choices[0].message.reasoning` or reasoning detail fields                  |
| Token counts                            | `usage.prompt_tokens`, `usage.completion_tokens`, and `usage.total_tokens` |
| Calculated request cost                 | `usage.cost_usd`, when present                                             |

Extract only the assistant text with `jq`:

```bash theme={null}
curl -s https://api.inquantum.ai/v1/chat/completions \
  -H "Authorization: Bearer $PLANCK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Say hello."}]
  }' | jq -r '.choices[0].message.content'
```

Do not assume `choices[0]` contains text for every operation. Tool-calling responses can contain `tool_calls`, Anthropic-compatible responses contain typed content blocks, and streaming responses arrive as a sequence of deltas.

## 5. Choose the next pattern

| Use case                       | Start here                                        |
| ------------------------------ | ------------------------------------------------- |
| Render text as it arrives      | [Streaming chat completions](/gateway/streaming)  |
| Build a complete browser chat  | [Build a streaming chat UI](/gateway/chat-ui)     |
| Return machine-validated JSON  | [Structured JSON](/gateway/structured-json)       |
| Let the model invoke your code | [Tool calling](/gateway/tool-calling)             |
| Send image input               | [Model capabilities](/gateway/model-capabilities) |
| Configure thinking effort      | [Reasoning and thinking](/gateway/reasoning)      |
| Use the Responses API          | [Responses API](/gateway/concepts/responses-api)  |
| Generate embeddings            | [Embeddings](/gateway/embeddings)                 |
| Rerank search results          | [Reranking](/gateway/reranking)                   |
| Configure providers or BYOK    | [Provider routing](/gateway/provider-routing)     |

## Common mistakes

* Sending a Planck key to a provider URL instead of `https://api.inquantum.ai`.
* Putting the API key in client-side code.
* Assuming a model-level capability means every provider endpoint supports it.
* Treating the model's maximum output as a default. OpenAI-compatible output limits are optional; Anthropic Messages requires `max_tokens`.
* Parsing every response as plain text without checking `finish_reason`, tool calls, reasoning fields, or stream events.

For authentication, validation, rate-limit, and provider failures, follow the [error-handling guide](/gateway/concepts/error-handling).
