Make your first API call
Activate your endpoint, create an API key and call MedErtas from Python, JavaScript or cURL through the Ertas AI Gateway in about five minutes.
On this page
This guide takes you from a new account to a working API call to MedErtas. You need an Ertas account and an OpenAI SDK, or just curl.
Activate your endpoint
Verify a card or buy credits or a plan. Verifying a card gives you 150 free credits, which is enough for plenty of test requests. Your endpoint is usually ready a minute or two later. See Activating your endpoint.
Create an API key
Open Gateway → API Keys, create a key and copy it. It is shown once. Save it in your environment as ERTAS_API_KEY:
export ERTAS_API_KEY="etk_..."Point your client at the gateway
Set your client's base URL to https://gateway.ertas.ai/v1.
Use a model ID
Use ertas-ai/medertas-27b or ertas-ai/medertas-31b. Each model page in the app has a copy button for its ID.
Send a request
from openai import OpenAI
import os
client = OpenAI(
base_url="https://gateway.ertas.ai/v1",
api_key=os.environ["ERTAS_API_KEY"],
)
resp = client.chat.completions.create(
model="ertas-ai/medertas-27b",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
print(resp.usage)The reply's usage object shows the input, cached and output tokens the API call was billed for. Your balance and usage history are in Gateway → Overview.
Prefer to let your coding agent do it?
Paste this into your coding agent (Cursor, Claude Code, Codex, OpenCode or similar) from the root of your project.
If something goes wrong
- 401
missing_tokenorinvalid_token: the key isn't reaching the gateway. CheckERTAS_API_KEYis set in the process that makes the API call. - 402
ertas_endpoint_inactive: verify a card or make a purchase first. - 503
ertas_endpoint_provisioning: your endpoint is still being set up. Retry after theRetry-Afterseconds.
The full list is in Errors and retries.