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

# Inference quickstart

> List models, make a chat call, and stream a response.

These examples use a Compose Key against the hosted API.

```bash theme={null}
export COMPOSE_MARKET_API_KEY="compose-..."
export COMPOSE_API_URL="https://api.compose.market"
```

Use `/v1/*` when you want Compose receipts or x402 behavior. Use `/external/v1/*` when you are configuring an OpenAI-compatible IDE, SDK, or app.

## List models

```bash theme={null}
curl "$COMPOSE_API_URL/v1/models" \
  -H "Authorization: Bearer $COMPOSE_MARKET_API_KEY"
```

The response is a generated catalog. Use `data[].modelId` as the model string on native routes.

```json theme={null}
{
  "object": "list",
  "data": [
    {
      "modelId": "gpt-5.5",
      "provider": "azure",
      "input": ["text", "image"],
      "output": ["text"]
    }
  ]
}
```

## Make a chat call

Native routes are OpenAI-shaped, with Compose payment metadata added where it belongs.

```bash theme={null}
curl "$COMPOSE_API_URL/v1/chat/completions" \
  -H "Authorization: Bearer $COMPOSE_MARKET_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-chain-id: 43113" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      { "role": "user", "content": "Write a terse deployment checklist." }
    ]
  }'
```

The response is an OpenAI-compatible chat completion. Native responses may include `receipt` in the JSON body, and receipt data is also exposed through `X-Receipt` when available.

## Stream a chat call

```bash theme={null}
curl -N "$COMPOSE_API_URL/v1/chat/completions" \
  -H "Authorization: Bearer $COMPOSE_MARKET_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-chain-id: 43113" \
  -d '{
    "model": "gpt-5.5",
    "stream": true,
    "stream_options": { "include_usage": true },
    "messages": [
      { "role": "user", "content": "Say hello in three words." }
    ]
  }'
```

Streaming uses Server-Sent Events. Native chat streams emit OpenAI chat completion chunks, usage chunks, optional Compose receipt events, and then `[DONE]`.

## Use an external OpenAI-compatible client

Use `/external/v1` when the client expects an OpenAI base URL.

```bash theme={null}
curl "$COMPOSE_API_URL/external/v1/chat/completions" \
  -H "Authorization: Bearer $COMPOSE_MARKET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      { "role": "user", "content": "Hello from an OpenAI-compatible client." }
    ]
  }'
```

External responses keep the body clean for OpenAI-compatible clients. Provider diagnostics are still available in headers:

| Header                | Meaning                                  |
| --------------------- | ---------------------------------------- |
| `x-public-model`      | Public catalog ID the client requested.  |
| `x-upstream-provider` | Provider selected by the resolver.       |
| `x-upstream-model`    | Provider wire model sent to the adapter. |

## Related

* [External clients](/inference/external-use/overview)
* [OpenCode config](/inference/external-use/configs/well-known-opencode)
* [Streaming](/inference/streaming)
* [Metering](/inference/metering)
