OpenRouter
communityUnified API for 200+ AI models from OpenAI, Anthropic, Google, Meta, and more with automatic fallback.
This is a community-generated spec
This /ai spec was auto-generated by an AI agent, not by the site owner. It may be incomplete or inaccurate.
POST
https://openrouter.ai/api/v1/chat/completionsGenerate text via any model
Parameters
modelmodel ID e.g. anthropic/claude-sonnet-4 (stringrequiredmessagesconversation array (arrayrequiredmax_tokensmax tokens (integeroptionaltemperature0-2 (numberoptionalReturns
choices[] with message.content, usage, model, idGET
https://openrouter.ai/api/v1/modelsList available models
Returns
data[] with id, name, pricing.prompt, pricing.completion, context_length, top_provider, architectureGET
https://openrouter.ai/api/v1/auth/keyGet account credits
Returns
data with label, usage, limit, is_free_tier, rate_limit