# Make your first API request

## 1. Create a key

Sign in to the [API key dashboard](/api-keys), create a key, and configure its model access. Keep the key on your server; do not expose it in browser code or commit it to Git.

The examples already contain the platform API origin. Set `API_KEY` to your key in your shell environment; it is an environment variable, not a model ID.

## 2. Pick a model

```bash
curl "https://newrouters.com/v1/models" -H "Authorization: Bearer $API_KEY"
curl "https://newrouters.com/v1/media-models"
```

Use the exact ID and protocol from the live catalog. If your intended model is absent, stop and check access or availability rather than substituting another model.

## 3. Follow its guide

- [GPT Image 2](/docs/models/gpt-image-2): create and poll an image task.
- [GPT-5.5](/docs/models/gpt-5-5): send an OpenAI chat request.
- [Complete API reference](/docs/api): all supported protocols and shared endpoints.

### Submit an image task

This request uses the platform model + input envelope. Running it creates a generation task and incurs usage; check your account pricing first.

```bash
curl "https://newrouters.com/v1/tasks" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "gpt-image-2",
  "input": {
    "prompt": "A small red house in a quiet garden",
    "quality": "medium",
    "resolution": "1k",
    "output_format": "jpeg"
  }
}'
```

HTTP 202 means the task was accepted. Selected response fields, with illustrative values:

```json
{
  "id": "TASK_ID",
  "status": "pending",
  "result": null,
  "error": null
}
```


- [Common API](/docs/common-api): discover models, check account points and retrieve tasks.

## 4. Review the result and usage

```bash
curl "https://newrouters.com/v1/tasks/TASK_ID" \
  -H "Authorization: Bearer $API_KEY"
```

Replace TASK_ID with the response id. Read result.assets[] on succeeded, or error on failed; poll the same task while pending or processing.

For media, the creation response is not the final generated result. Poll the returned task ID until success or failure. For LLMs, retain the request ID and usage information; review billing in the dashboard.
