Loading...

Docs · Getting started

Connect your SDK

The base URL, every endpoint with its auth header, working examples for the OpenAI and Anthropic SDKs, and what each error status means.

Use the SDK you already have; the key goes where the provider's key would go. The API endpoint panel at the top of the API keys page lists every path with a copy button. Copy base URL copies the origin https://ai.topxea.com without /v1: right for the Anthropic SDK; OpenAI-style SDKs need /v1 added, or copy the endpoint row.

Your first successful request

  1. Open API keys and create a key for the model family you want to test. A key's route and model limits determine what it can call; choosing a model in a client does not expand those permissions.
  2. Check Wallet. New accounts start with an empty balance, so add credit before the first request: every top-up earns a 3–12% bonus by amount, and your first one earns an extra 10%. A key's own quota must also cover the request reservation.
  3. Copy the matching example below, replace the placeholder with your key locally, and run it once. Keep the output limit small. Never paste your key into a support message or a public issue.
  4. Confirm that a response arrived, then open Usage to check the model, route and charge. A successful /v1/models response only confirms model discovery; it does not prove a generation succeeded.

For a desktop client, follow the Cherry Studio setup. Start with one model on one route, then add more after the first call succeeds.

Endpoints

OpenAI Python SDK

Pass the base URL with /v1; the SDK appends /chat/completions.

from openai import OpenAI

client = OpenAI(base_url="https://ai.topxea.com/v1", api_key="sk-...")
reply = client.chat.completions.create(
    model="claude-sonnet-5-5",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    max_tokens=64,
)
print(reply.choices[0].message.content)

Anthropic SDK

The Anthropic SDK appends /v1/messages itself, so its base URL is the origin; the key travels as x-api-key.

from anthropic import Anthropic

client = Anthropic(base_url="https://ai.topxea.com", api_key="sk-...")
reply = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(reply.content[0].text)

Coding tools

If the first call fails

Every error message ends with a request id you can send to support@topxea.com.

Related

Previous: Create an API key and choose a route · Next: API reference: every endpoint, with an OpenAPI specification

Other languages: 简体中文