Docs contents
API Documentation
Everything you need to call models through GoiAPI: one API key, the OpenAI or Anthropic format, and the tools you already use.
Ask AI and more
- QuickstartCreate an account, top up with USDT, create an API key and call your first model through GoiAPI in a few minutes, with curl, an SDK or Claude Code.
- Authentication with API keysSend your GoiAPI API key in the Authorization Bearer or x-api-key header, keep it in environment variables, and restrict each key by IP and model.
- OpenAI-compatible API (Chat Completions)Call models through POST /v1/chat/completions on GoiAPI, compatible with OpenAI SDKs and tools; request body, streaming and how to change the base URL.
- OpenAI Responses APICall models through POST /v1/responses on GoiAPI (Codex CLI, OpenAI SDK responses.create); supported features, streaming events and limitations.
- Anthropic-compatible API (Messages)Call models through POST /v1/messages and count tokens with /v1/messages/count_tokens on GoiAPI; works with Claude Code and the Anthropic SDKs.
- List models via the APIGet the models your API key can call with GET /v1/models on GoiAPI, in OpenAI or Anthropic format, sorted by name. Listing models is free of charge.
- Streaming (SSE)Receive responses incrementally with stream true on GoiAPI: SSE format for the OpenAI and Anthropic APIs, keep-alive pings and mid-stream errors.
- Error codesHTTP error codes returned by GoiAPI (401, 402, 403, 404, 429, 503…), error body formats for the OpenAI and Anthropic APIs, and the x-request-id support ID.
- Limits and balancePer-minute request limits for API keys, how GoiAPI holds funds based on max_tokens, when you get a 402 error, body size and maximum run time.
Integration guides
- Claude CodeUse Claude Code with your own API key: set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, pick a Claude model, then send a test message from your terminal.
- CursorUse Cursor with your own API key: add it as the OpenAI API key, override the base URL, add the model name, then send a test message from the Cursor chat.
- Cline / Roo CodeSet up Cline and Roo Code in VS Code to call models with your API key: choose the OpenAI Compatible provider, enter the base URL, key and model name.
- Codex CLISet up Codex CLI with a custom model provider in ~/.codex/config.toml, keep your API key in an environment variable, then send a test prompt from the terminal.
- OpenAI SDKCall models from Python or Node.js with the official OpenAI library: change only the base URL and API key, keep your existing code, then send a test request.
- Anthropic SDKCall Claude models from Python with the official Anthropic library: change only the base URL and API key, keep your existing code, then send a test request.
- curlCall the API over plain HTTP with curl, in OpenAI or Anthropic format: copy a ready-made request, add your API key and model name, then read the JSON reply.