Início rápido
From signing in to a working integration. Each step takes a minute or two, and you can stop after step 3 if all you need is one call.
What you are about to do - Get a key, prove it works without writing code, wire it into your app, then keep it topped up. Where a welcome campaign is running you can do the first calls on free credit; otherwise a small top-up comes first.
1. Obtenha sua chave de API
Faça login e acesse Console → Chaves de API. Clique em "Criar chave" e copie-a imediatamente - ela só será exibida uma vez.
2. Faça sua primeira requisição
Escolha o SDK que você já usa. Ambas as receitas acessam o mesmo gateway com a mesma chave de API.
Opção A - SDK da OpenAI
curl https://synthorai.io/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-5.4-mini",
"messages": [
{"role": "user", "content": "Hello! What can you do?"}
]
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://synthorai.io/v1"
)
response = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[{"role": "user", "content": "Hello! What can you do?"}]
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://synthorai.io/v1",
});
const response = await client.chat.completions.create({
model: "gpt-5.4-mini",
messages: [{ role: "user", content: "Hello! What can you do?" }],
});
console.log(response.choices[0].message.content);Opção B - SDK da Anthropic
curl https://synthorai.io/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{"role": "user", "content": "Hello! What can you do?"}
]
}'from anthropic import Anthropic
client = Anthropic(
api_key="YOUR_API_KEY",
base_url="https://synthorai.io"
)
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=256,
messages=[{"role": "user", "content": "Hello! What can you do?"}]
)
print(message.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "YOUR_API_KEY",
baseURL: "https://synthorai.io",
});
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 256,
messages: [{ role: "user", content: "Hello! What can you do?" }],
});
console.log(message.content[0].text);O SDK da Anthropic anexa /v1/messages internamente. Use a origem do gateway (sem /v1 como sufixo) base_url - ao contrário do SDK da OpenAI, que usa https://synthorai.io/v1.
3. Try it without writing code
Open the Playground in the console, pick a model and send a prompt. It runs through the same pipeline as your API traffic, so a reply confirms the model and your balance. It authenticates with your console session rather than an API key, so test the key itself with the request above.
4. Liste os modelos disponíveis
curl https://synthorai.io/v1/models \
-H "Authorization: Bearer YOUR_API_KEY" Os IDs de modelo seguem o formato usado pelo provedor original. Você pode ver a lista completa com o endpoint /v1/models ou acesse a página Catálogo de modelos .
5. Wire it into your app
Point your existing client at the gateway: change the base URL and use your Synthorai key. Your model ids, request shapes and SDKs stay as they are. From there the capability guides cover the things that change your bill - caching a repeated prefix, or capping how much a model thinks.
Using Claude Code, Codex CLI or OpenClaw instead of an SDK? Those have their own one-line setup:
6. Add credit when you need it
Usage draws down a prepaid balance - no monthly platform fee, no subscription. Top up from Billing with a card or crypto; the balance is usable the moment it lands. Free credit comes from a welcome campaign where one is running, not automatically on signup.
Where to go next
- Prompt caching - bill a repeated prefix at a fraction of its normal price
- Reasoning effort - the biggest cost lever on models that reason by default
- API keys - quotas, model allowlists, expiry and rotation
- Usage analytics - where the spend actually went
Autenticação
Todas as requisições à API exigem uma chave de API passada no Authorization cabeçalho.
Token Bearer
Authorization: Bearer YOUR_API_KEY Escopos da chave
| Parâmetro | Tipo | Descrição |
|---|---|---|
Read | string | Acesso apenas à lista de modelos e aos dados de uso. |
Write | string | Fazer requisições de inferência (chat, completions). |
Admin | string | Acesso completo, incluindo o gerenciamento de canais e usuários. |
Nunca exponha sua chave de API em código do lado do cliente ou em repositórios públicos. Rotacione as chaves imediatamente se forem comprometidas via Console → Chaves de API.
Formato da chave
As chaves da Synthorai têm o prefixo sk- seguido por uma cadeia aleatória de 32 caracteres. As chaves são armazenadas com hash e não podem ser recuperadas após a criação.
Não sabe por qual modelo começar? Explore a model price comparison para ver lado a lado o preço por token de cada modelo roteável.