Endpoints, protocols, and authentication
Distinguish gateway origins, versioned paths, SDK base URLs, and API credentials.
Select an endpoint
Purpose | Address |
|---|---|
Gateway origin | |
OpenAI SDK / Codex base URL | |
Anthropic SDK / Claude Code base URL | |
Chat Completions | |
Responses | |
Anthropic Messages | |
Gemini text generation | |
Model list | |
SDKs usually append the operation path. Do not use /chat/completions as an SDK base URL or duplicate /v1. Console URLs and browser-session endpoints are not inference endpoints.
Configure credentials
Set these Bash variables, replacing the credential placeholder. See the curl guide for PowerShell.
export IROUTER_API_KEY='<your-irouter-api-key>'
export IROUTER_API_BASE='https://gateway.irouter.io/v1'OpenAI-style requests use Authorization: Bearer ...; Messages examples use x-api-key and anthropic-version; Gemini examples use x-goog-api-key. Keep keys in headers, not URLs or application logs. Do not mix protocol headers and payloads.
Request conventions
Send Content-Type: application/json for JSON. Use multipart for file uploads where required, without manually setting its boundary. Obtain model IDs from model discovery. Output limits, filenames, and prompts in examples are sample inputs, not account quotas or model capacity claims.
Availability depends on the model, line, and permissions. Each tutorial lists required fields. Add optional parameters only after confirming support.
Inspect responses
JSON and SSE need different parsers. For errors, retain the HTTP status, sanitized message, and any request identifier returned, then follow troubleshooting. Console business-error envelopes are not a universal inference response format.