# Quick start

https://modelportal.ai/docs/quick-start

Your first call takes four steps: sign up, create an API key, send a request, and pick a provider if you want to. The examples below are ready to copy; replace `YOUR_API_KEY` with your key and `MODEL_ID` with a model ID.

## 1. Sign up

Register with your email and click the link in the verification email. Creating keys and topping up both require a verified email; the link is valid for 24 hours and works once. If the instance offers a trial credit to new users, it is granted automatically once your email is verified; it then shows in your console balance. Without a trial credit, top up on the Top up page first.

## 2. Create an API key

Open the Keys page in the console and enter a name. A full key looks like `mp-xxxxxxxx.xxxx` and is shown only once, right after creation, so save it immediately. After that only the last 4 characters are shown; if you lose it, revoke it and create a new one. See [API keys](/docs/api-keys).

Use keys on the server only: keep them in server-side environment variables or a secret manager, never in browser pages, mobile app bundles or public repositories.

## 3. Send your first request

Find a model in the [catalog](/models). The model ID on its page is the value of the `model` field. The three snippets below send the same request:

```bash
curl https://modelportal.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_ID", "messages": [{"role": "user", "content": "Hello"}]}'
```

```python
from openai import OpenAI

client = OpenAI(base_url="https://modelportal.ai/v1", api_key="YOUR_API_KEY")
reply = client.chat.completions.create(
    model="MODEL_ID",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)
```

```typescript
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://modelportal.ai/v1", apiKey: "YOUR_API_KEY" });
const reply = await client.chat.completions.create({
  model: "MODEL_ID",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(reply.choices[0].message.content);
```

Run `pip install openai` for Python or `npm install openai` for TypeScript first. `choices[0].message.content` in the response is the model's answer, and the cost of the call appears on the Billing page of the console.

The platform offers three compatible APIs, all on this site's domain:

| Protocol | Base URL | Auth |
| --- | --- | --- |
| OpenAI-compatible | `https://modelportal.ai/v1` | `Authorization: Bearer <key>` |
| Anthropic-compatible | `https://modelportal.ai` (no `/v1`) | `x-api-key: <key>` or Bearer |
| Gemini-compatible | `https://modelportal.ai/v1beta` (Google GenAI SDK: `https://modelportal.ai`) | `x-goog-api-key: <key>`, the `key` query parameter, or Bearer |

## 4. Pick a provider

A model usually has offers from several providers. With no settings, the platform picks the cheapest eligible endpoint by comparison price and locks the request to it: if it fails you get the error, and the request does not move to another provider. To prefer a provider, add a `provider` object to the request body:

```bash
curl https://modelportal.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_ID", "messages": [{"role": "user", "content": "Hello"}], "provider": {"order": ["PROVIDER_ID"]}}'
```

Replace `PROVIDER_ID` with a provider identifier from the endpoint list on the model page. When no endpoint meets the constraints, you get HTTP 422 with the code `no_eligible_endpoint` and a message explaining why. All `provider` fields are listed in [Provider selection](/docs/provider-routing).

## Defaults to know

- Streaming: add `"stream": true`; the OpenAI format ends with `data: [DONE]`. See [Streaming](/docs/streaming).
- Without `max_tokens` (or `max_completion_tokens`), the platform fills in a value from the model's output limit and your available balance. In the Anthropic format `max_tokens` is required.
- `GET /v1/models` lists only the models the current key can call.
- A low balance returns HTTP 402 `insufficient_balance`; top up to continue. See [Common errors](/docs/errors) for more.

## FAQ

### What goes in the model field?

The Model ID shown on the model's catalog page. GET /v1/models also lists every model ID your key can call.

### Do I have to verify my email first?

Yes for creating API keys, topping up and redeeming codes. Browsing the catalog and prices does not need it.

### Which SDKs work?

Official OpenAI SDKs work with base_url set to https://modelportal.ai/v1, and Anthropic SDKs with https://modelportal.ai itself, without /v1. Google GenAI SDKs work with base_url set to https://modelportal.ai itself, without /v1beta, and the key as the API key.

### What if I omit max_tokens?

In the OpenAI and Gemini formats the platform fills one in: the model's maximum output (4096 if the model sets none), trimmed to what your available balance can pay for. In the Anthropic format max_tokens is required and the request fails without it.

