Quickstart

Applies to: Developer · Team · Enterprise — Last reviewed 2026-06-29

GotoAI is an OpenAI-compatible gateway. You make your first call by pointing the OpenAI SDK at the GotoAI base URL with a GotoAI API key.

Before you start

  • Create an API key in the Console.
  • Export it as GOTOAI_API_KEY in your environment.

1. Install the SDK

pip install openai
npm install openai

2. Make a request

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["GOTOAI_API_KEY"],
    base_url="{{api_base}}",
)

resp = client.chat.completions.create(
    model="{{default_model}}",
    messages=[{"role": "user", "content": "Reply in one sentence."}],
    max_tokens={{max_tokens}},
)
print(resp.choices[0].message.content)
curl {{api_base}}/chat/completions \
  -H "Authorization: Bearer $GOTOAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"{{default_model}}","messages":[{"role":"user","content":"Reply in one sentence."}],"max_tokens":{{max_tokens}}}'

3. Verify

A successful response returns a chat completion and an X-HyperCore-Provider header showing which provider served it. Check your usage and ledger in the Console under Billing.

Keep max_tokens small (≤ {{max_tokens}}) during S1 — there is a max output token cap. See Errors.

Common errors

  • 401 — missing or invalid API key. See API keys.
  • 402 — insufficient balance; recharge in the Console.
  • 403model_restricted; the model is admin-only.

Next steps