Quickstart
Key, base URL and the first request to a model in a few minutes.
The first request takes three steps: get a key, choose a model, send a request. The API is compatible with OpenAI and Anthropic, so their SDKs and any client with a configurable URL work.
Get a key
Open "API keys" in the console and click "Create key". A key like mg-… is shown in full once. Save it in an environment variable:
export MORPHOGEN_API_KEY=mg-...More about key limits and access: Keys and access.
Choose a URL
| SDK | base_url |
|---|---|
| OpenAI | https://api.morphogen.ru/v1 |
| Anthropic | https://api.morphogen.ru |
Pass the key in the Authorization: Bearer <key> header. The x-api-key: <key> header is accepted too: the Anthropic SDK sends it.
Choose a model
The models available to your key:
curl https://api.morphogen.ru/v1/models \
-H "Authorization: Bearer $MORPHOGEN_API_KEY"Take names from the response, not from memory: the catalog changes.
Send a request
curl https://api.morphogen.ru/v1/chat/completions \
-H "Authorization: Bearer $MORPHOGEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 200,
"messages": [{"role": "user", "content": "Привет"}]
}'Without it, the request reserves an amount based on the model's maximum response length. With a small balance or key limit, the request may then return 402. In /v1/responses the field is called max_output_tokens.
For a streaming response, add "stream": true to the request body.
What you can call
All requests go to https://api.morphogen.ru with your key.
| Task | Request |
|---|---|
| Text, OpenAI Chat format | POST /v1/chat/completions |
| Text, OpenAI Responses format | POST /v1/responses |
| Text, Anthropic format | POST /v1/messages |
| Embeddings | POST /v1/embeddings |
| Speech recognition | POST /v1/audio/transcriptions |
| Images | POST /v1/images/generations |
| Video | POST /v1/videos |
| Model list | GET /v1/models |
Any model of the "Text" or "Code" type accepts any of the three text formats.
If the request failed
Errors come in the OpenAI format: the code is in error.code. Common cases:
- 401: the key is missing, invalid, revoked or expired.
- 402
insufficient_funds: the balance does not cover the request reserve. - 403
model_not_allowed: the model is not in the key's list. - 429
rate_limit_exceeded: the key went over its per-minute request or token limit (120 and 200,000 by default). Retry after the time in theRetry-Afterheader.
Full list: Errors.