# Your first API request

This guide sends one small request and prints the answer. You need an account, an API key, and credits when using a paid model.

## 1. Create an API key

Open [API Keys in the dashboard](https://app.simplellm.eu/api-keys) and create a key. Copy the secret when it is displayed and keep it on your server.

Set an environment variable in the terminal where you will run the examples:

~~~bash
export SIMPLELLM_API_KEY='YOUR_API_KEY'
export SIMPLELLM_MODEL='qwen3.8-flash-next'
~~~

~~~powershell
$env:SIMPLELLM_API_KEY = 'YOUR_API_KEY'
$env:SIMPLELLM_MODEL = 'qwen3.8-flash-next'
~~~

`qwen3.8-flash-next` is an example ID verified in the public catalogue on 2026-09-14, not a permanent availability promise. Replace it with your selected chat model.

## 2. Check the model catalogue

~~~bash
curl --fail-with-body https://api.simplellm.eu/v1/models \
  -H "Authorization: Bearer $SIMPLELLM_API_KEY"
~~~

Read each model's `id`. Prices and context windows are in the [model catalogue](/docs/models.html), not in the standard OpenAI model-list response.

## 3. Send a chat completion

The cURL example requires cURL and jq; Python and TypeScript examples are on the [client examples page](/docs/sdks.html).

~~~bash
jq -n --arg model "$SIMPLELLM_MODEL" '{
  model: $model,
  messages: [
    {role: "system", content: "Answer briefly and clearly."},
    {role: "user", content: "What is an API?"}
  ],
  max_tokens: 1024,
  stream: false
}' | curl --fail-with-body https://api.simplellm.eu/v1/chat/completions \
  -H "Authorization: Bearer $SIMPLELLM_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @-
~~~

This is a billed inference request when the selected model has a price.

## 4. Read the answer and usage

The response has a `choices` array. Read `choices[0].message.content` for the answer and `usage` for the reported token counts. This is an illustrative shape, not an actual request receipt:

~~~json
{
  "id": "chatcmpl-example",
  "object": "chat.completion",
  "created": 1789380000,
  "model": "qwen3.8-flash-next",
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "An API is an interface that lets software communicate."},
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 28, "completion_tokens": 18, "total_tokens": 46}
}
~~~

A reasoning model may use part of its output budget before returning visible text. If the answer is empty and the finish reason is `length`, inspect the budget and [reasoning guidance](/docs/reasoning.html).

## Next steps

- [Stream the response](/docs/streaming.html) instead of waiting for the entire answer.
- [Add conversation history](/docs/chat.html) for follow-up questions.
- [Connect OpenCode](/docs/opencode.html) or [OpenClaw](/docs/openclaw.html).
- [Handle errors](/docs/errors.html) before deploying an integration.
