# Authentication and Authorization

## Introduction

ModelVerse API uses API Key for authentication. All API requests must include a valid API Key in the HTTP request header.

## Obtain API Key

Please visit the [ModelVerse Console](https://console.ucloud.cn/modelverse/experience/api-keys) to create and manage your API Key.

> Note: Please keep your API Key secure and do not disclose it to others.

<img src="https://cdnv2-cache.udelivrs.com/2026/08/a6490f68e86d045e01066728b9ea4eb5_1786071042575.png" alt="codex-model" class="medium-zoom-image" style="">

## API Endpoint

Choose an API endpoint based on your access location and region requirements:

- **Unified endpoint (recommended):** No need to select a specific region. If a region fails, the platform can switch this endpoint to a backup region without requiring you to change the API URL.
- **Regional endpoint:** Connects to a specific region and does not participate in cross-region failover. Use it when you have latency, region preference, or data residency requirements.

> Failover for unified endpoints takes time to take effect, depending on DNS caching. Some requests or existing connections may be affected during the transition.

### Unified endpoints (recommended)

| Area | API Endpoint | Description |
| --- | --- | --- |
| China Mainland | `api.modelverse.cn` | Unified endpoint recommended for users in China |
| Overseas | `api.umodelverse.ai` | Unified endpoint recommended for overseas users |

### Regional endpoints

| Region | API Endpoint | Description |
| --- | --- | --- |
| Ulanqab | `api-cn-wlcb.modelverse.cn` | Connects directly to the Ulanqab region |
| Shanghai 2 | `api-cn-sh2.modelverse.cn` | Connects directly to the Shanghai 2 region |
| US Los Angeles | `api-us-ca.umodelverse.ai` | Recommended for overseas users, data does not route back to China |
| Singapore | `api-sg.umodelverse.ai` | Recommended for Southeast Asia users, faster access |
| Frankfurt | `api-ge-fra.umodelverse.ai` | Recommended for European users, faster access |

## Simple API Call

Please replace `{api_key}` with your API Key. The example uses the overseas unified endpoint; you can replace it with any endpoint from the tables above.

```bash
curl --location 'https://api.umodelverse.ai/v1/chat/completions' \
--header "Authorization: Bearer {api_key}" \
--header 'Content-Type: application/json' \
--data '{
    "model": "deepseek-ai/DeepSeek-R1",
    "messages": [
        {
            "role": "user",
            "content": "Describe the company AstraFlow in one sentence."
        }
    ]
}' | jq .
```

An example of the returned result you might see.

```
{
  "id": "0a7919c4-981e-438b-ad30-e943b96882b6",
  "object": "chat.completion",
  "created": 1763015400,
  "model": "deepseek-r1-250528",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A Sci-Tech board-listed cloud service provider offering neutral, secure, localized cloud computing services, focusing on serving Chinese enterprises in digital transformation."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 348,
    "total_tokens": 358,
    "prompt_tokens_details": null,
    "completion_tokens_details": {
      "audio_tokens": 0,
      "reasoning_tokens": 185,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "system_fingerprint": "",
  "search_result": null
}
```
