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.

    Ask AI about this page
    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

    Step 1

    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

    Step 2

    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

    Step 3

    Set your client's base URL to https://gateway.ertas.ai/v1.

    Use a model ID

    Step 4

    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.

    Prompt for your coding agent
    Route my LLM calls for "ertas-ai/medertas-27b" through the Ertas AI Gateway. It speaks the OpenAI Chat Completions API, so only the base URL and the key change. 1. Set the client's base URL to https://gateway.ertas.ai/v1. 2. Read the key from the ERTAS_API_KEY environment variable. If it is missing, stop and tell me to create one in Ertas → API Keys. 3. Use the model id "ertas-ai/medertas-27b" exactly. 4. Leave streaming and tool calls unchanged. 5. Make one test call and show me the reply and the token usage. Tell me which files you changed.

    If something goes wrong

    • 401 missing_token or invalid_token: the key isn't reaching the gateway. Check ERTAS_API_KEY is 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 the Retry-After seconds.

    The full list is in Errors and retries.

    What's next