openrouter
Module openrouter
Definitions
ballerinax/openrouter Ballerina library
Overview
OpenRouter is a unified API platform that provides access to multiple AI language models from various providers, allowing developers to easily switch between and compare different models through a single interface.
The ballerinax/openrouter package offers APIs to connect and interact with OpenRouter API endpoints, specifically based on OpenRouter API v1.
Setup guide
To use the OpenRouter connector, you must have access to the OpenRouter API through an OpenRouter developer account and obtain an API access token. If you do not have an OpenRouter account, you can sign up for one here.
Step 1: Create an OpenRouter Account
-
Navigate to the OpenRouter website and sign up for an account or log in if you already have one.
-
Note that OpenRouter operates on a pay-per-use model with credits, and API access is available to all registered users regardless of plan type.
Step 2: Generate an API Access Token
-
Log in to your OpenRouter account.
-
Navigate to the Keys section by clicking on your profile in the top right corner and selecting "Keys" from the dropdown menu.
-
Click on "Create Key" to generate a new API key.
-
Provide a name for your key and set any optional restrictions if needed, then click "Create Key".
Tip: You must copy and store this key somewhere safe. It won't be visible again in your account settings for security reasons.
Quickstart
To use the openrouter connector in your Ballerina application, update the .bal file as follows:
Step 1: Import the module
import ballerinax/openrouter;
Step 2: Instantiate a new connector
- Create a
Config.tomlfile and configure the obtained access token:
token = "<Your_OpenRouter_API_Token>"
- Create an
openrouter:ConnectionConfigand initialize the client:
configurable string token = ?; final openrouter:Client openrouterClient = check new({ auth: { token } });
Step 3: Invoke the connector operation
Now, utilize the available connector operations.
Create a chat completion
public function main() returns error? { openrouter:ChatGenerationParams chatRequest = { model: "openai/gpt-3.5-turbo", messages: [ { role: "user", content: "Hello! Can you help me write a simple greeting message?" } ], max_tokens: 150, temperature: 0.7 }; openrouter:ChatResponse response = check openrouterClient->/chat/completions.post(chatRequest); }
Step 4: Run the Ballerina application
bal run
Examples
The openrouter connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
- Ai model deployment pipeline - Demonstrates how to automate AI model deployment processes using Ballerina connector for OpenRouter.
- Ai security audit - Illustrates conducting security audits for AI systems and models.
Clients
openrouter: Client
OpenAI-compatible API with additional OpenRouter features
Constructor
Gets invoked to initialize the connector.
init (ConnectionConfig config, string serviceUrl)- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://openrouter.ai/api/v1" - URL of the target service
post responses
function post responses(OpenResponsesRequest payload, CreateResponsesHeaders headers) returns OpenResponsesNonStreamingResponse|errorCreate a response
Parameters
- payload OpenResponsesRequest -
- headers CreateResponsesHeaders (default {}) - Headers to be sent with the request
Return Type
- OpenResponsesNonStreamingResponse|error - Successful response
post messages
function post messages(AnthropicMessagesRequest payload, CreateMessagesHeaders headers) returns AnthropicMessagesResponse|errorCreate a message
Parameters
- payload AnthropicMessagesRequest -
- headers CreateMessagesHeaders (default {}) - Headers to be sent with the request
Return Type
- AnthropicMessagesResponse|error - Successful response
get activity
function get activity(GetUserActivityHeaders headers, *GetUserActivityQueries queries) returns ActivityResponse|errorGet user activity grouped by endpoint
Parameters
- headers GetUserActivityHeaders (default {}) - Headers to be sent with the request
- queries *GetUserActivityQueries - Queries to be sent with the request
Return Type
- ActivityResponse|error - Returns user activity data grouped by endpoint
post chat/completions
function post chat/completions(ChatGenerationParams payload, SendChatCompletionRequestHeaders headers) returns ChatResponse|errorCreate a chat completion
Parameters
- payload ChatGenerationParams -
- headers SendChatCompletionRequestHeaders (default {}) - Headers to be sent with the request
Return Type
- ChatResponse|error - Successful chat completion response
get credits
function get credits(GetCreditsHeaders headers) returns CreditsResponse|errorGet remaining credits
Parameters
- headers GetCreditsHeaders (default {}) - Headers to be sent with the request
Return Type
- CreditsResponse|error - Returns the total credits purchased and used
post credits/coinbase
function post credits/coinbase(CreateChargeRequest payload, CreateCoinbaseChargeHeaders headers) returns CoinbaseCreditResponse|errorCreate a Coinbase charge for crypto payment
Parameters
- payload CreateChargeRequest -
- headers CreateCoinbaseChargeHeaders (default {}) - Headers to be sent with the request
Return Type
- CoinbaseCreditResponse|error - Returns the calldata to fulfill the transaction
post embeddings
function post embeddings(CreateEmbeddingsRequest payload, CreateEmbeddingsHeaders headers) returns CreateEmbeddingsResponse|errorSubmit an embedding request
Parameters
- payload CreateEmbeddingsRequest -
- headers CreateEmbeddingsHeaders (default {}) - Headers to be sent with the request
Return Type
- CreateEmbeddingsResponse|error - Embedding response
get embeddings/models
function get embeddings/models(ListEmbeddingsModelsHeaders headers) returns ModelsListResponse|errorList all embeddings models
Parameters
- headers ListEmbeddingsModelsHeaders (default {}) - Headers to be sent with the request
Return Type
- ModelsListResponse|error - Returns a list of embeddings models
get generation
function get generation(GetGenerationHeaders headers, *GetGenerationQueries queries) returns GenerationResponse|errorGet request & usage metadata for a generation
Parameters
- headers GetGenerationHeaders (default {}) - Headers to be sent with the request
- queries *GetGenerationQueries - Queries to be sent with the request
Return Type
- GenerationResponse|error - Returns the request metadata for this generation
get models/count
function get models/count(ListModelsCountHeaders headers) returns ModelsCountResponse|errorGet total count of available models
Parameters
- headers ListModelsCountHeaders (default {}) - Headers to be sent with the request
Return Type
- ModelsCountResponse|error - Returns the total count of available models
get models
function get models(GetModelsHeaders headers, *GetModelsQueries queries) returns ModelsListResponse|errorList all models and their properties
Parameters
- headers GetModelsHeaders (default {}) - Headers to be sent with the request
- queries *GetModelsQueries - Queries to be sent with the request
Return Type
- ModelsListResponse|error - Returns a list of models or RSS feed
get models/user
function get models/user(ListModelsUserHeaders headers) returns ModelsListResponse|errorList models filtered by user provider preferences, privacy settings, and guardrails
Parameters
- headers ListModelsUserHeaders (default {}) - Headers to be sent with the request
Return Type
- ModelsListResponse|error - Returns a list of models filtered by user provider preferences
get models/[string author]/[string slug]/endpoints
function get models/[string author]/[string slug]/endpoints(ListEndpointsHeaders headers) returns ModelEndpointsResponse|errorList all endpoints for a model
Parameters
- headers ListEndpointsHeaders (default {}) - Headers to be sent with the request
Return Type
- ModelEndpointsResponse|error - Returns a list of endpoints
get endpoints/zdr
function get endpoints/zdr(ListEndpointsZdrHeaders headers) returns ZdrEndpointsResponse|errorPreview the impact of ZDR on the available endpoints
Parameters
- headers ListEndpointsZdrHeaders (default {}) - Headers to be sent with the request
Return Type
- ZdrEndpointsResponse|error - Returns a list of endpoints
get providers
function get providers(ListProvidersHeaders headers) returns ProvidersResponse|errorList all providers
Parameters
- headers ListProvidersHeaders (default {}) - Headers to be sent with the request
Return Type
- ProvidersResponse|error - Returns a list of providers
get keys
function get keys(ListHeaders headers, *ListQueries queries) returns KeysListResponse|errorList API keys
Parameters
- headers ListHeaders (default {}) - Headers to be sent with the request
- queries *ListQueries - Queries to be sent with the request
Return Type
- KeysListResponse|error - List of API keys
post keys
function post keys(CreateKeyRequest payload, CreateKeysHeaders headers) returns CreateKeyResponse|errorCreate a new API key
Parameters
- payload CreateKeyRequest -
- headers CreateKeysHeaders (default {}) - Headers to be sent with the request
Return Type
- CreateKeyResponse|error - API key created successfully
get keys/[string hash]
function get keys/[string hash](GetKeyHeaders headers) returns KeyDetailsResponse|errorGet a single API key
Parameters
- headers GetKeyHeaders (default {}) - Headers to be sent with the request
Return Type
- KeyDetailsResponse|error - API key details
delete keys/[string hash]
function delete keys/[string hash](DeleteKeysHeaders headers) returns DeleteKeyResponse|errorDelete an API key
Parameters
- headers DeleteKeysHeaders (default {}) - Headers to be sent with the request
Return Type
- DeleteKeyResponse|error - API key deleted successfully
patch keys/[string hash]
function patch keys/[string hash](UpdateKeyRequest payload, UpdateKeysHeaders headers) returns UpdateKeyResponse|errorUpdate an API key
Parameters
- payload UpdateKeyRequest -
- headers UpdateKeysHeaders (default {}) - Headers to be sent with the request
Return Type
- UpdateKeyResponse|error - API key updated successfully
get guardrails
function get guardrails(ListGuardrailsHeaders headers, *ListGuardrailsQueries queries) returns GuardrailListResponse|errorList guardrails
Parameters
- headers ListGuardrailsHeaders (default {}) - Headers to be sent with the request
- queries *ListGuardrailsQueries - Queries to be sent with the request
Return Type
- GuardrailListResponse|error - List of guardrails
post guardrails
function post guardrails(CreateGuardrailRequest payload, CreateGuardrailHeaders headers) returns CreateGuardrailResponse|errorCreate a guardrail
Parameters
- payload CreateGuardrailRequest -
- headers CreateGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- CreateGuardrailResponse|error - Guardrail created successfully
get guardrails/[string id]
function get guardrails/[string id](GetGuardrailHeaders headers) returns GetGuardrailResponse|errorGet a guardrail
Parameters
- headers GetGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- GetGuardrailResponse|error - Guardrail details
delete guardrails/[string id]
function delete guardrails/[string id](DeleteGuardrailHeaders headers) returns DeleteGuardrailResponse|errorDelete a guardrail
Parameters
- headers DeleteGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- DeleteGuardrailResponse|error - Guardrail deleted successfully
patch guardrails/[string id]
function patch guardrails/[string id](UpdateGuardrailRequest payload, UpdateGuardrailHeaders headers) returns UpdateGuardrailResponse|errorUpdate a guardrail
Parameters
- payload UpdateGuardrailRequest -
- headers UpdateGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- UpdateGuardrailResponse|error - Guardrail updated successfully
get guardrails/assignments/keys
function get guardrails/assignments/keys(ListKeyAssignmentsHeaders headers, *ListKeyAssignmentsQueries queries) returns GuardrailKeyAssignmentsResponse|errorList all key assignments
Parameters
- headers ListKeyAssignmentsHeaders (default {}) - Headers to be sent with the request
- queries *ListKeyAssignmentsQueries - Queries to be sent with the request
Return Type
- GuardrailKeyAssignmentsResponse|error - List of key assignments
get guardrails/assignments/members
function get guardrails/assignments/members(ListMemberAssignmentsHeaders headers, *ListMemberAssignmentsQueries queries) returns GuardrailMemberAssignmentsResponse|errorList all member assignments
Parameters
- headers ListMemberAssignmentsHeaders (default {}) - Headers to be sent with the request
- queries *ListMemberAssignmentsQueries - Queries to be sent with the request
Return Type
- GuardrailMemberAssignmentsResponse|error - List of member assignments
get guardrails/[string id]/assignments/keys
function get guardrails/[string id]/assignments/keys(ListGuardrailKeyAssignmentsHeaders headers, *ListGuardrailKeyAssignmentsQueries queries) returns GuardrailKeyAssignmentsResponse|errorList key assignments for a guardrail
Parameters
- headers ListGuardrailKeyAssignmentsHeaders (default {}) - Headers to be sent with the request
- queries *ListGuardrailKeyAssignmentsQueries - Queries to be sent with the request
Return Type
- GuardrailKeyAssignmentsResponse|error - List of key assignments
post guardrails/[string id]/assignments/keys
function post guardrails/[string id]/assignments/keys(AssignKeysRequest payload, BulkAssignKeysToGuardrailHeaders headers) returns AssignKeysResponse|errorBulk assign keys to a guardrail
Parameters
- payload AssignKeysRequest -
- headers BulkAssignKeysToGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- AssignKeysResponse|error - Assignment result
get guardrails/[string id]/assignments/members
function get guardrails/[string id]/assignments/members(ListGuardrailMemberAssignmentsHeaders headers, *ListGuardrailMemberAssignmentsQueries queries) returns GuardrailMemberAssignmentsResponse|errorList member assignments for a guardrail
Parameters
- headers ListGuardrailMemberAssignmentsHeaders (default {}) - Headers to be sent with the request
- queries *ListGuardrailMemberAssignmentsQueries - Queries to be sent with the request
Return Type
- GuardrailMemberAssignmentsResponse|error - List of member assignments
post guardrails/[string id]/assignments/members
function post guardrails/[string id]/assignments/members(AssignMembersRequest payload, BulkAssignMembersToGuardrailHeaders headers) returns AssignMembersResponse|errorBulk assign members to a guardrail
Parameters
- payload AssignMembersRequest -
- headers BulkAssignMembersToGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- AssignMembersResponse|error - Assignment result
post guardrails/[string id]/assignments/keys/remove
function post guardrails/[string id]/assignments/keys/remove(RemoveKeysRequest payload, BulkUnassignKeysFromGuardrailHeaders headers) returns RemoveKeysResponse|errorBulk unassign keys from a guardrail
Parameters
- payload RemoveKeysRequest -
- headers BulkUnassignKeysFromGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- RemoveKeysResponse|error - Unassignment result
post guardrails/[string id]/assignments/members/remove
function post guardrails/[string id]/assignments/members/remove(RemoveMembersRequest payload, BulkUnassignMembersFromGuardrailHeaders headers) returns RemoveMembersResponse|errorBulk unassign members from a guardrail
Parameters
- payload RemoveMembersRequest -
- headers BulkUnassignMembersFromGuardrailHeaders (default {}) - Headers to be sent with the request
Return Type
- RemoveMembersResponse|error - Unassignment result
get 'key
function get 'key(GetCurrentKeyHeaders headers) returns CurrentKeyResponse|errorGet current API key
Parameters
- headers GetCurrentKeyHeaders (default {}) - Headers to be sent with the request
Return Type
- CurrentKeyResponse|error - API key details
post auth/keys
function post auth/keys(AuthKeyRequest payload, ExchangeAuthCodeForAPIKeyHeaders headers) returns AuthKeyResponse|errorExchange authorization code for API key
Parameters
- payload AuthKeyRequest -
- headers ExchangeAuthCodeForAPIKeyHeaders (default {}) - Headers to be sent with the request
Return Type
- AuthKeyResponse|error - Successfully exchanged code for an API key
post auth/keys/code
function post auth/keys/code(KeyCodeRequest payload, CreateAuthKeysCodeHeaders headers) returns KeyCodeResponse|errorCreate authorization code
Parameters
- payload KeyCodeRequest -
- headers CreateAuthKeysCodeHeaders (default {}) - Headers to be sent with the request
Return Type
- KeyCodeResponse|error - Successfully created authorization code
Records
openrouter: ActivityItem
Fields
- date string - Date of the activity (YYYY-MM-DD format)
- model string - Model slug (e.g., "openai/gpt-4.1")
- model_permaslug string - Model permaslug (e.g., "openai/gpt-4.1-2025-04-14")
- endpoint_id string - Unique identifier for the endpoint
- provider_name string - Name of the provider serving this endpoint
- usage decimal - Total cost in USD (OpenRouter credits spent)
- byok_usage_inference decimal - BYOK inference cost in USD (external credits spent)
- requests decimal - Number of requests made
- prompt_tokens decimal - Total prompt tokens used
- completion_tokens decimal - Total completion tokens generated
- reasoning_tokens decimal - Total reasoning tokens used
openrouter: ActivityResponse
Fields
- data ActivityItem[] - List of activity items
openrouter: AnthropicCacheControl
Fields
- 'type "ephemeral" -
- ttl? "5m"|"1h" -
openrouter: AnthropicMessagesMetadata
Fields
- user_id? string -
openrouter: AnthropicMessagesProvider
When multiple model providers are available, optionally indicate your routing preference.
Fields
- allow_fallbacks? boolean - Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
- require_parameters? boolean - Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
- data_collection? DataCollection - Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
- zdr? boolean - Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
- enforce_distillable_text? boolean - Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
- 'order? (ProviderName|string)[] - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
- only? (ProviderName|string)[] - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
- ignore? (ProviderName|string)[] - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
- quantizations? Quantization[] - A list of quantization levels to filter the provider by.
- sort? ProviderSort -
- max_price? OpenResponsesRequest_provider_max_price - The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
- preferred_min_throughput? PreferredMinThroughput - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
- preferred_max_latency? PreferredMaxLatency - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
openrouter: AnthropicMessagesRequest
Request schema for Anthropic Messages API endpoint
Fields
- model string -
- max_tokens decimal -
- messages OpenRouterAnthropicMessageParam[] -
- system? string|record { 'type "text" , text string, citations (record { 'type "char_location" , cited_text string, document_index decimal, document_title string, start_char_index decimal, end_char_index decimal }|record { 'type "page_location" , cited_text string, document_index decimal, document_title string, start_page_number decimal, end_page_number decimal }|record { 'type "content_block_location" , cited_text string, document_index decimal, document_title string, start_block_index decimal, end_block_index decimal }|record { 'type "web_search_result_location" , cited_text string, encrypted_index string, title string, url string }|record { 'type "search_result_location" , cited_text string, search_result_index decimal, 'source string, title string, start_block_index decimal, end_block_index decimal })[], cache_control record { 'type "ephemeral" , ttl "5m"|"1h" } }[] -
- metadata? AnthropicMessagesMetadata -
- stop_sequences? string[] -
- 'stream? boolean -
- temperature? decimal -
- top_p? decimal -
- top_k? decimal -
- tools? (anydata)[] -
- thinking? record { 'type "enabled" , budget_tokens decimal }|record { 'type "disabled" }|record { 'type "adaptive" } -
- service_tier? "auto"|"standard_only" -
- cache_control? AnthropicCacheControl -
- provider? AnthropicMessagesProvider - When multiple model providers are available, optionally indicate your routing preference.
- plugins? (record { id "auto-router" , enabled boolean, allowed_models string[] }|record { id "moderation" }|record { id "web" , enabled boolean, max_results decimal, search_prompt string, engine WebSearchEngine, native_tool_version "web_search_20250305"|"web_search_20260209" , include_domains string[], exclude_domains string[] }|record { id "file-parser" , enabled boolean, pdf PDFParserOptions }|record { id "response-healing" , enabled boolean })[] - Plugins you want to enable for this request, including their settings.
- route? "fallback"|"sort" - DEPRECATED Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
- user? string - A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
- session_id? string - A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
- trace? OpenResponsesRequest_trace - Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
- models? string[] -
- output_config? AnthropicOutputConfig - Configuration for controlling output behavior. Currently supports the effort parameter for Claude Opus 4.5.
openrouter: AnthropicMessagesResponse
Non-streaming response from the Anthropic Messages API with OpenRouter extensions
Fields
- Fields Included from *BaseAnthropicMessagesResponse
- id string
- type "message"
- role "assistant"
- content anydata[]
- model string
- stop_reason "end_turn"|"max_tokens"|"stop_sequence"|"tool_use"|"pause_turn"|"refusal"
- stop_sequence string
- usage BaseAnthropicMessagesResponse_usage
- anydata...
- provider? "AnyScale"|"Atoma"|"Cent-ML"|"CrofAI"|"Enfer"|"GoPomelo"|"HuggingFace"|"Hyperbolic 2"|"InoCloud"|"Kluster"|"Lambda"|"Lepton"|"Lynn 2"|"Lynn"|"Mancer"|"Meta"|"Modal"|"Nineteen"|"OctoAI"|"Recursal"|"Reflection"|"Replicate"|"SambaNova 2"|"SF Compute"|"Targon"|"Together 2"|"Ubicloud"|"01.AI"|"AI21"|"AionLabs"|"Alibaba"|"Ambient"|"Amazon Bedrock"|"Amazon Nova"|"Anthropic"|"Arcee AI"|"AtlasCloud"|"Avian"|"Azure"|"BaseTen"|"BytePlus"|"Black Forest Labs"|"Cerebras"|"Chutes"|"Cirrascale"|"Clarifai"|"Cloudflare"|"Cohere"|"Crusoe"|"DeepInfra"|"DeepSeek"|"Featherless"|"Fireworks"|"Friendli"|"GMICloud"|"Google"|"Google AI Studio"|"Groq"|"Hyperbolic"|"Inception"|"Inceptron"|"InferenceNet"|"Ionstream"|"Infermatic"|"Io Net"|"Inflection"|"Liquid"|"Mara"|"Mancer 2"|"Minimax"|"ModelRun"|"Mistral"|"Modular"|"Moonshot AI"|"Morph"|"NCompass"|"Nebius"|"NextBit"|"Novita"|"Nvidia"|"OpenAI"|"OpenInference"|"Parasail"|"Perplexity"|"Phala"|"Relace"|"SambaNova"|"Seed"|"SiliconFlow"|"Sourceful"|"StepFun"|"Stealth"|"StreamLake"|"Switchpoint"|"Together"|"Upstage"|"Venice"|"WandB"|"Xiaomi"|"xAI"|"Z.AI"|"FakeProvider" -
openrouter: AnthropicOutputConfig
Configuration for controlling output behavior. Currently supports the effort parameter for Claude Opus 4.5.
Fields
- effort? "low"|"medium"|"high"|"max" - How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer. Valid values are
low,medium,high, ormax.
openrouter: ApiKeyInfo
The API key information
Fields
- hash string - Unique hash identifier for the API key
- name string - Name of the API key
- label string - Human-readable label for the API key
- disabled boolean - Whether the API key is disabled
- 'limit decimal - Spending limit for the API key in USD
- limit_remaining decimal - Remaining spending limit in USD
- limit_reset string - Type of limit reset for the API key
- include_byok_in_limit boolean - Whether to include external BYOK usage in the credit limit
- usage decimal - Total OpenRouter credit usage (in USD) for the API key
- usage_daily decimal - OpenRouter credit usage (in USD) for the current UTC day
- usage_weekly decimal - OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
- usage_monthly decimal - OpenRouter credit usage (in USD) for the current UTC month
- byok_usage decimal - Total external BYOK usage (in USD) for the API key
- byok_usage_daily decimal - External BYOK usage (in USD) for the current UTC day
- byok_usage_weekly decimal - External BYOK usage (in USD) for the current UTC week (Monday-Sunday)
- byok_usage_monthly decimal - External BYOK usage (in USD) for current UTC month
- created_at string - ISO 8601 timestamp of when the API key was created
- updated_at string - ISO 8601 timestamp of when the API key was last updated
- expires_at? string - ISO 8601 UTC timestamp when the API key expires, or null if no expiration
openrouter: AssignKeysRequest
Fields
- key_hashes AssignKeyHash[] - Array of API key hashes to assign to the guardrail
openrouter: AssignKeysResponse
Fields
- assigned_count decimal - Number of keys successfully assigned
openrouter: AssignMembersRequest
Fields
- member_user_ids AssignMemberUserId[] - Array of member user IDs to assign to the guardrail
openrouter: AssignMembersResponse
Fields
- assigned_count decimal - Number of members successfully assigned
openrouter: AssistantMessage
Assistant message for requests and responses
Fields
- role "assistant" -
- content? anydata - Assistant message content
- name? string - Optional name for the assistant
- tool_calls? ChatMessageToolCall[] - Tool calls made by the assistant
- refusal? string - Refusal message if content was refused
- reasoning? string - Reasoning output
- reasoning_details? AssistantMessageReasoningDetails - Reasoning details for extended thinking models
- images? AssistantMessageImages - Generated images from image generation models
- audio? ChatCompletionAudioOutput - Audio output data or reference
- phase? anydata - The phase of an assistant message. Use
commentaryfor an intermediate assistant message andfinal_answerfor the final assistant message. For follow-up requests with models likegpt-5.3-codexand later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages.
openrouter: AuthKeyRequest
Fields
- code string - The authorization code received from the OAuth redirect
- code_verifier? string - The code verifier if code_challenge was used in the authorization request
- code_challenge_method? "S256"|"plain" - The method used to generate the code challenge
openrouter: AuthKeyResponse
Fields
- 'key string - The API key to use for OpenRouter requests
- user_id string - User ID associated with the API key
openrouter: BaseAnthropicMessagesResponse
Fields
- id string -
- 'type "message" -
- role "assistant" -
- content (anydata)[] -
- model string -
- stop_reason "end_turn"|"max_tokens"|"stop_sequence"|"tool_use"|"pause_turn"|"refusal" -
- stop_sequence string -
openrouter: BaseAnthropicMessagesResponse_usage
Fields
- input_tokens decimal -
- output_tokens decimal -
- cache_creation_input_tokens decimal -
- cache_read_input_tokens decimal -
- cache_creation BaseAnthropicMessagesResponse_usage_cache_creation -
- inference_geo string -
- server_tool_use BaseAnthropicMessagesResponse_usage_server_tool_use -
- service_tier "standard"|"priority"|"batch" -
openrouter: BaseAnthropicMessagesResponse_usage_cache_creation
Fields
- ephemeral_5m_input_tokens decimal -
- ephemeral_1h_input_tokens decimal -
openrouter: BaseAnthropicMessagesResponse_usage_server_tool_use
Fields
- web_search_requests decimal -
openrouter: BulkAssignKeysToGuardrailHeaders
Represents the Headers record for the operation: bulkAssignKeysToGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: BulkAssignMembersToGuardrailHeaders
Represents the Headers record for the operation: bulkAssignMembersToGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: BulkUnassignKeysFromGuardrailHeaders
Represents the Headers record for the operation: bulkUnassignKeysFromGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: BulkUnassignMembersFromGuardrailHeaders
Represents the Headers record for the operation: bulkUnassignMembersFromGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ChatCompletionAudioOutput
Audio output data or reference
Fields
- id? string - Audio output identifier
- expires_at? decimal - Audio expiration timestamp
- data? string - Base64 encoded audio data
- transcript? string - Audio transcript
openrouter: ChatGenerationParams
Chat completion request parameters
Fields
- provider? AnthropicMessagesProvider - When multiple model providers are available, optionally indicate your routing preference.
- plugins? (record { id "auto-router" , enabled boolean, allowed_models string[] }|record { id "moderation" }|record { id "web" , enabled boolean, max_results decimal, search_prompt string, engine WebSearchEngine, native_tool_version "web_search_20250305"|"web_search_20260209" , include_domains string[], exclude_domains string[] }|record { id "file-parser" , enabled boolean, pdf PDFParserOptions }|record { id "response-healing" , enabled boolean })[] - Plugins you want to enable for this request, including their settings.
- route? "fallback"|"sort" - DEPRECATED Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
- user? string - Unique user identifier
- session_id? string - A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
- trace? OpenResponsesRequest_trace - Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
- messages Message[] - List of messages for the conversation
- model? ModelName - Model to use for completion
- models? ModelNames - Models to use for completion
- frequency_penalty? decimal - Frequency penalty (-2.0 to 2.0)
- logit_bias? record {||} - Token logit bias adjustments
- logprobs? boolean - Return log probabilities
- top_logprobs? decimal - Number of top log probabilities to return (0-20)
- max_completion_tokens? decimal - Maximum tokens in completion
- max_tokens? decimal - Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
- metadata? record { string... } - Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
- presence_penalty? decimal - Presence penalty (-2.0 to 2.0)
- reasoning? ChatGenerationParams_reasoning - Configuration options for reasoning models
- response_format? ResponseFormatText|ResponseFormatJSONObject|ResponseFormatJSONSchema|ResponseFormatTextGrammar|ResponseFormatTextPython - Response format configuration
- seed? int - Random seed for deterministic outputs
- stop? anydata - Stop sequences (up to 4)
- 'stream boolean(default false) - Enable streaming response
- stream_options? ChatStreamOptions - Streaming configuration options
- temperature decimal(default 1) - Sampling temperature (0-2)
- parallel_tool_calls? boolean -
- tool_choice? ToolChoiceOption - Tool choice configuration
- tools? ToolDefinitionJson[] - Available tools for function calling
- top_p decimal(default 1) - Nucleus sampling parameter (0-1)
- debug? DebugOptions - Debug options for inspecting request transformations (streaming only)
- image_config? record {} - Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
- modalities? ("text"|"image"|"audio")[] - Output modalities for the response. Supported values are "text", "image", and "audio".
- cache_control? ChatGenerationParams_cache_control - Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
openrouter: ChatGenerationParams_cache_control
Enable automatic prompt caching. When set, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
Fields
- 'type "ephemeral" -
- ttl? "5m"|"1h" -
openrouter: ChatGenerationParams_reasoning
Configuration options for reasoning models
Fields
- effort? "xhigh"|"high"|"medium"|"low"|"minimal"|"none" - Constrains effort on reasoning for reasoning models
- summary? anydata -
openrouter: ChatGenerationTokenUsage
Token usage statistics
Fields
- completion_tokens decimal - Number of tokens in the completion
- prompt_tokens decimal - Number of tokens in the prompt
- total_tokens decimal - Total number of tokens
- completion_tokens_details? ChatGenerationTokenUsage_completion_tokens_details - Detailed completion token usage
- prompt_tokens_details? ChatGenerationTokenUsage_prompt_tokens_details - Detailed prompt token usage
openrouter: ChatGenerationTokenUsage_completion_tokens_details
Detailed completion token usage
Fields
- reasoning_tokens? decimal - Tokens used for reasoning
- audio_tokens? decimal - Tokens used for audio output
- accepted_prediction_tokens? decimal - Accepted prediction tokens
- rejected_prediction_tokens? decimal - Rejected prediction tokens
openrouter: ChatGenerationTokenUsage_prompt_tokens_details
Detailed prompt token usage
Fields
- cached_tokens? decimal - Cached prompt tokens
- cache_write_tokens? decimal - Tokens written to cache. Only returned for models with explicit caching and cache write pricing.
- audio_tokens? decimal - Audio input tokens
- video_tokens? decimal - Video input tokens
openrouter: ChatMessageContentItemAudio
Audio input content part. Supported audio formats vary by provider.
Fields
- 'type "input_audio" -
- input_audio ChatMessageContentItemAudio_input_audio -
openrouter: ChatMessageContentItemAudio_input_audio
Fields
- data string - Base64 encoded audio data
- format string - Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider.
openrouter: ChatMessageContentItemCacheControl
Cache control for the content part
Fields
- 'type "ephemeral" -
- ttl? "5m"|"1h" -
openrouter: ChatMessageContentItemFile
File content part for document processing
Fields
- 'type "file" -
openrouter: ChatMessageContentItemFile_file
Fields
- file_data? string - File content as base64 data URL or URL
- file_id? string - File ID for previously uploaded files
- filename? string - Original filename
openrouter: ChatMessageContentItemImage
Image content part for vision models
Fields
- 'type "image_url" -
- image_url ChatMessageContentItemImage_image_url -
openrouter: ChatMessageContentItemImage_image_url
Fields
- url string - URL of the image (data: URLs supported)
- detail? "auto"|"low"|"high" - Image detail level for vision models
openrouter: ChatMessageContentItemText
Text content part
Fields
- 'type "text" -
- text string -
- cache_control? ChatMessageContentItemCacheControl - Cache control for the content part
openrouter: ChatMessageContentItemVideo
Video input content part
Fields
- 'type "video_url" -
- video_url VideoInput - Video input object
openrouter: ChatMessageContentItemVideoLegacy
Video input content part (legacy format - deprecated)
Fields
- 'type "input_video" -
- video_url VideoInput - Video input object
Deprecated
openrouter: ChatMessageTokenLogprob
Token log probability information
Fields
- token string - The token
- logprob decimal - Log probability of the token
- bytes decimal[] - UTF-8 bytes of the token
openrouter: ChatMessageTokenLogprobs
Log probabilities for the completion
Fields
- content ChatMessageTokenLogprob[] - Log probabilities for content tokens
- refusal? ChatMessageTokenLogprob[] - Log probabilities for refusal tokens
openrouter: ChatMessageToolCall
Tool call made by the assistant
Fields
- id string - Tool call identifier
- 'type "function" -
- 'function ChatMessageToolCall_function -
openrouter: ChatMessageToolCall_function
Fields
- name string - Function name to call
- arguments string - Function arguments as JSON string
openrouter: ChatResponse
Chat completion response
Fields
- id string - Unique completion identifier
- choices ChatResponseChoice[] - List of completion choices
- created decimal - Unix timestamp of creation
- model string - Model used for completion
- 'object "chat.completion" -
- system_fingerprint? string - System fingerprint
- usage? ChatGenerationTokenUsage - Token usage statistics
openrouter: ChatResponseChoice
Chat completion choice
Fields
- finish_reason anydata -
- index decimal - Choice index
- message AssistantMessage - Assistant message for requests and responses
- logprobs? ChatMessageTokenLogprobs - Log probabilities for the completion
openrouter: ChatStreamOptions
Streaming configuration options
Fields
- include_usage? boolean - Deprecated: This field has no effect. Full usage details are always included.
openrouter: CoinbaseCreditData
Fields
- id string -
- created_at string -
- expires_at string -
- web3_data Web3Data -
openrouter: CoinbaseCreditResponse
Fields
- data CoinbaseCreditData -
openrouter: CompoundFilter
A compound filter that combines multiple comparison or compound filters
Fields
- 'type "and"|"or" -
- filters record {}[] -
openrouter: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 30) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded/x-forwardedheader
- followRedirects? FollowRedirects - Configurations associated with Redirection
- poolConfig? PoolConfiguration - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding) header
- circuitBreaker? CircuitBreakerConfig - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig? RetryConfig - Configurations associated with retrying
- cookieConfig? CookieConfig - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket? ClientSecureSocket - SSL/TLS-related options
- proxy? ProxyConfig - Proxy server related options
- socketConfig ClientSocketConfig(default {}) - Provides settings related to client socket configuration
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
- laxDataBinding boolean(default true) - Enables relaxed data binding on the client side. When enabled,
nilvalues are treated as optional, and absent fields are handled asnilabletypes. Enabled by default.
openrouter: CreateAuthKeysCodeHeaders
Represents the Headers record for the operation: createAuthKeysCode
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: CreateChargeRequest
Create a Coinbase charge for crypto payment
Fields
- amount decimal -
- sender string -
- chain_id 1|137|8453 -
openrouter: CreateCoinbaseChargeHeaders
Represents the Headers record for the operation: createCoinbaseCharge
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: CreatedKeyData
The created API key information
Fields
- hash string - Unique hash identifier for the API key
- name string - Name of the API key
- label string - Human-readable label for the API key
- disabled boolean - Whether the API key is disabled
- 'limit decimal - Spending limit for the API key in USD
- limit_remaining decimal - Remaining spending limit in USD
- limit_reset string - Type of limit reset for the API key
- include_byok_in_limit boolean - Whether to include external BYOK usage in the credit limit
- usage decimal - Total OpenRouter credit usage (in USD) for the API key
- usage_daily decimal - OpenRouter credit usage (in USD) for the current UTC day
- usage_weekly decimal - OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
- usage_monthly decimal - OpenRouter credit usage (in USD) for the current UTC month
- byok_usage decimal - Total external BYOK usage (in USD) for the API key
- byok_usage_daily decimal - External BYOK usage (in USD) for the current UTC day
- byok_usage_weekly decimal - External BYOK usage (in USD) for the current UTC week (Monday-Sunday)
- byok_usage_monthly decimal - External BYOK usage (in USD) for current UTC month
- created_at string - ISO 8601 timestamp of when the API key was created
- updated_at string - ISO 8601 timestamp of when the API key was last updated
- expires_at? string - ISO 8601 UTC timestamp when the API key expires, or null if no expiration
openrouter: CreateEmbeddingsHeaders
Represents the Headers record for the operation: createEmbeddings
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: CreateEmbeddingsRequest
Fields
- model string -
- encoding_format? "float"|"base64" -
- dimensions? int -
- user? string -
- provider? ProviderPreferences - Provider routing preferences for the request.
- input_type? string -
openrouter: CreateEmbeddingsResponse
Fields
- id? string -
- 'object "list" -
- model string -
- usage? CreateEmbeddingsResponseUsage -
openrouter: CreateEmbeddingsResponseUsage
Fields
- prompt_tokens decimal -
- total_tokens decimal -
- cost? decimal -
openrouter: CreateGuardrailHeaders
Represents the Headers record for the operation: createGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: CreateGuardrailRequest
Fields
- name string - Name for the new guardrail
- description? string - Description of the guardrail
- limit_usd? decimal - Spending limit in USD
- reset_interval? "daily"|"weekly"|"monthly" - Interval at which the limit resets (daily, weekly, monthly)
- allowed_providers? string[] - List of allowed provider IDs
- ignored_providers? string[] - List of provider IDs to exclude from routing
- allowed_models? string[] - Array of model identifiers (slug or canonical_slug accepted)
- enforce_zdr? boolean - Whether to enforce zero data retention
openrouter: CreateGuardrailResponse
Fields
- data GuardrailData - The created guardrail
openrouter: CreateKeyRequest
Fields
- name string - Name for the new API key
- 'limit? decimal - Optional spending limit for the API key in USD
- limit_reset? "daily"|"weekly"|"monthly" - Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
- include_byok_in_limit? boolean - Whether to include BYOK usage in the limit
- expires_at? string - Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected
openrouter: CreateKeyResponse
Fields
- data CreatedKeyData - The created API key information
- 'key string - The actual API key string (only shown once)
openrouter: CreateKeysHeaders
Represents the Headers record for the operation: createKeys
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: CreateMessagesHeaders
Represents the Headers record for the operation: createMessages
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: CreateResponsesHeaders
Represents the Headers record for the operation: createResponses
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: CreditsData
Fields
- total_credits decimal - Total credits purchased
- total_usage decimal - Total credits used
openrouter: CreditsResponse
Total credits purchased and used
Fields
- data CreditsData -
openrouter: CurrentKeyData
Current API key information
Fields
- label string - Human-readable label for the API key
- 'limit decimal - Spending limit for the API key in USD
- usage decimal - Total OpenRouter credit usage (in USD) for the API key
- usage_daily decimal - OpenRouter credit usage (in USD) for the current UTC day
- usage_weekly decimal - OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
- usage_monthly decimal - OpenRouter credit usage (in USD) for the current UTC month
- byok_usage decimal - Total external BYOK usage (in USD) for the API key
- byok_usage_daily decimal - External BYOK usage (in USD) for the current UTC day
- byok_usage_weekly decimal - External BYOK usage (in USD) for the current UTC week (Monday-Sunday)
- byok_usage_monthly decimal - External BYOK usage (in USD) for current UTC month
- is_free_tier boolean - Whether this is a free tier API key
- is_management_key boolean - Whether this is a management key
- is_provisioning_key boolean - Whether this is a management key
- limit_remaining decimal - Remaining spending limit in USD
- limit_reset string - Type of limit reset for the API key
- include_byok_in_limit boolean - Whether to include external BYOK usage in the credit limit
- expires_at? string - ISO 8601 UTC timestamp when the API key expires, or null if no expiration
- rate_limit KeyRateLimit - Legacy rate limit information about a key. Will always return -1.
openrouter: CurrentKeyResponse
Fields
- data CurrentKeyData - Current API key information
openrouter: DebugOptions
Debug options for inspecting request transformations (streaming only)
Fields
- echo_upstream_body? boolean - If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode.
openrouter: DefaultParameters
Default parameters for this model
Fields
- temperature? decimal -
- top_p? decimal -
- top_k? int -
- frequency_penalty? decimal -
- presence_penalty? decimal -
- repetition_penalty? decimal -
openrouter: DeleteGuardrailHeaders
Represents the Headers record for the operation: deleteGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: DeleteGuardrailResponse
Fields
- deleted boolean - Confirmation that the guardrail was deleted
openrouter: DeleteKeyResponse
Fields
- deleted boolean - Confirmation that the API key was deleted
openrouter: DeleteKeysHeaders
Represents the Headers record for the operation: deleteKeys
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: DeveloperMessage
Developer message
Fields
- role "developer" -
- content string|ChatMessageContentItemText[] - Developer message content
- name? string - Optional name for the developer message
openrouter: ExchangeAuthCodeForAPIKeyHeaders
Represents the Headers record for the operation: exchangeAuthCodeForAPIKey
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: FileCitation
Fields
- 'type "file_citation" -
- file_id string -
- filename string -
- index decimal -
openrouter: FilePath
Fields
- 'type "file_path" -
- file_id string -
- index decimal -
openrouter: GenerationData
Generation data
Fields
- id string - Unique identifier for the generation
- upstream_id string - Upstream provider's identifier for this generation
- total_cost decimal - Total cost of the generation in USD
- cache_discount decimal - Discount applied due to caching
- upstream_inference_cost decimal - Cost charged by the upstream provider
- created_at string - ISO 8601 timestamp of when the generation was created
- model string - Model used for the generation
- app_id decimal - ID of the app that made the request
- streamed boolean - Whether the response was streamed
- cancelled boolean - Whether the generation was cancelled
- provider_name string - Name of the provider that served the request
- latency decimal - Total latency in milliseconds
- moderation_latency decimal - Moderation latency in milliseconds
- generation_time decimal - Time taken for generation in milliseconds
- finish_reason string - Reason the generation finished
- tokens_prompt decimal - Number of tokens in the prompt
- tokens_completion decimal - Number of tokens in the completion
- native_tokens_prompt decimal - Native prompt tokens as reported by provider
- native_tokens_completion decimal - Native completion tokens as reported by provider
- native_tokens_completion_images decimal - Native completion image tokens as reported by provider
- native_tokens_reasoning decimal - Native reasoning tokens as reported by provider
- native_tokens_cached decimal - Native cached tokens as reported by provider
- num_media_prompt decimal - Number of media items in the prompt
- num_input_audio_prompt decimal - Number of audio inputs in the prompt
- num_media_completion decimal - Number of media items in the completion
- num_search_results decimal - Number of search results included
- origin string - Origin URL of the request
- usage decimal - Usage amount in USD
- is_byok boolean - Whether this used bring-your-own-key
- native_finish_reason string - Native finish reason as reported by provider
- external_user string - External user identifier
- api_type "completions"|"embeddings" - Type of API used for the generation
- router string - Router used for the request (e.g., openrouter/auto)
- provider_responses record { id string, endpoint_id string, model_permaslug string, provider_name "AnyScale"|"Atoma"|"Cent-ML"|"CrofAI"|"Enfer"|"GoPomelo"|"HuggingFace"|"Hyperbolic 2"|"InoCloud"|"Kluster"|"Lambda"|"Lepton"|"Lynn 2"|"Lynn"|"Mancer"|"Meta"|"Modal"|"Nineteen"|"OctoAI"|"Recursal"|"Reflection"|"Replicate"|"SambaNova 2"|"SF Compute"|"Targon"|"Together 2"|"Ubicloud"|"01.AI"|"AI21"|"AionLabs"|"Alibaba"|"Ambient"|"Amazon Bedrock"|"Amazon Nova"|"Anthropic"|"Arcee AI"|"AtlasCloud"|"Avian"|"Azure"|"BaseTen"|"BytePlus"|"Black Forest Labs"|"Cerebras"|"Chutes"|"Cirrascale"|"Clarifai"|"Cloudflare"|"Cohere"|"Crusoe"|"DeepInfra"|"DeepSeek"|"Featherless"|"Fireworks"|"Friendli"|"GMICloud"|"Google"|"Google AI Studio"|"Groq"|"Hyperbolic"|"Inception"|"Inceptron"|"InferenceNet"|"Ionstream"|"Infermatic"|"Io Net"|"Inflection"|"Liquid"|"Mara"|"Mancer 2"|"Minimax"|"ModelRun"|"Mistral"|"Modular"|"Moonshot AI"|"Morph"|"NCompass"|"Nebius"|"NextBit"|"Novita"|"Nvidia"|"OpenAI"|"OpenInference"|"Parasail"|"Perplexity"|"Phala"|"Relace"|"SambaNova"|"Seed"|"SiliconFlow"|"Sourceful"|"StepFun"|"Stealth"|"StreamLake"|"Switchpoint"|"Together"|"Upstage"|"Venice"|"WandB"|"Xiaomi"|"xAI"|"Z.AI"|"FakeProvider" , status decimal, latency decimal, is_byok boolean }[] - List of provider responses for this generation, including fallback attempts
- user_agent string - User-Agent header from the request
- http_referer string - Referer header from the request
openrouter: GenerationResponse
Generation response
Fields
- data GenerationData - Generation data
openrouter: GetCreditsHeaders
Represents the Headers record for the operation: getCredits
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: GetCurrentKeyHeaders
Represents the Headers record for the operation: getCurrentKey
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: GetGenerationHeaders
Represents the Headers record for the operation: getGeneration
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: GetGenerationQueries
Represents the Queries record for the operation: getGeneration
Fields
- id string -
openrouter: GetGuardrailHeaders
Represents the Headers record for the operation: getGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: GetGuardrailResponse
Fields
- data GuardrailInfo - The guardrail
openrouter: GetKeyHeaders
Represents the Headers record for the operation: getKey
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: GetModelsHeaders
Represents the Headers record for the operation: getModels
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: GetModelsQueries
Represents the Queries record for the operation: getModels
Fields
- category? "programming"|"roleplay"|"marketing"|"marketing/seo"|"technology"|"science"|"translation"|"legal"|"finance"|"health"|"trivia"|"academia" - Filter models by use case category
- supported_parameters? string -
openrouter: GetUserActivityHeaders
Represents the Headers record for the operation: getUserActivity
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: GetUserActivityQueries
Represents the Queries record for the operation: getUserActivity
Fields
- date? string - Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
openrouter: GuardrailData
The created guardrail
Fields
- id string - Unique identifier for the guardrail
- name string - Name of the guardrail
- description? string - Description of the guardrail
- limit_usd? decimal - Spending limit in USD
- reset_interval? "daily"|"weekly"|"monthly" - Interval at which the limit resets (daily, weekly, monthly)
- allowed_providers? string[] - List of allowed provider IDs
- ignored_providers? string[] - List of provider IDs to exclude from routing
- allowed_models? string[] - Array of model canonical_slugs (immutable identifiers)
- enforce_zdr? boolean - Whether to enforce zero data retention
- created_at string - ISO 8601 timestamp of when the guardrail was created
- updated_at? string - ISO 8601 timestamp of when the guardrail was last updated
openrouter: GuardrailInfo
The guardrail
Fields
- id string - Unique identifier for the guardrail
- name string - Name of the guardrail
- description? string - Description of the guardrail
- limit_usd? decimal - Spending limit in USD
- reset_interval? "daily"|"weekly"|"monthly" - Interval at which the limit resets (daily, weekly, monthly)
- allowed_providers? string[] - List of allowed provider IDs
- ignored_providers? string[] - List of provider IDs to exclude from routing
- allowed_models? string[] - Array of model canonical_slugs (immutable identifiers)
- enforce_zdr? boolean - Whether to enforce zero data retention
- created_at string - ISO 8601 timestamp of when the guardrail was created
- updated_at? string - ISO 8601 timestamp of when the guardrail was last updated
openrouter: GuardrailKeyAssignmentsResponse
Fields
- total_count decimal - Total number of key assignments for this guardrail
openrouter: GuardrailListItem
Fields
- id string -
- name string -
- description? string -
- limit_usd? decimal -
- reset_interval? "daily"|"weekly"|"monthly" -
- allowed_providers? string[] -
- ignored_providers? string[] -
- allowed_models? string[] -
- enforce_zdr? boolean -
- created_at string -
- updated_at? string -
openrouter: GuardrailListResponse
Fields
- total_count decimal - Total number of guardrails
openrouter: GuardrailMemberAssignmentsResponse
Fields
- total_count decimal - Total number of member assignments
openrouter: JSONSchemaConfig
JSON Schema configuration object
Fields
- name string - Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)
- description? string - Schema description for the model
- schema? record {} - JSON Schema object
- strict? boolean - Enable strict schema adherence
openrouter: KeyCodeData
Auth code data
Fields
- id string - The authorization code ID to use in the exchange request
- app_id decimal - The application ID associated with this auth code
- created_at string - ISO 8601 timestamp of when the auth code was created
openrouter: KeyCodeRequest
Fields
- callback_url string - The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.
- code_challenge? string - PKCE code challenge for enhanced security
- code_challenge_method? "S256"|"plain" - The method used to generate the code challenge
- 'limit? decimal - Credit limit for the API key to be created
- expires_at? string - Optional expiration time for the API key to be created
- key_label? string - Optional custom label for the API key. Defaults to the app name if not provided.
- usage_limit_type? "daily"|"weekly"|"monthly" - Optional credit limit reset interval. When set, the credit limit resets on this interval.
- spawn_agent? string - Agent identifier for spawn telemetry
- spawn_cloud? string - Cloud identifier for spawn telemetry
openrouter: KeyCodeResponse
Fields
- data KeyCodeData - Auth code data
openrouter: KeyDetailsResponse
Fields
- data ApiKeyInfo - The API key information
openrouter: KeyRateLimit
Legacy rate limit information about a key. Will always return -1.
Fields
- requests decimal - Number of requests allowed per interval
- interval string - Rate limit interval
- note string - Note about the rate limit
Deprecated
openrouter: KeysListResponse
Fields
- data record { hash string, name string, label string, disabled boolean, 'limit decimal, limit_remaining decimal, limit_reset string, include_byok_in_limit boolean, usage decimal, usage_daily decimal, usage_weekly decimal, usage_monthly decimal, byok_usage decimal, byok_usage_daily decimal, byok_usage_weekly decimal, byok_usage_monthly decimal, created_at string, updated_at string, expires_at string }[] - List of API keys
openrouter: ListEmbeddingsModelsHeaders
Represents the Headers record for the operation: listEmbeddingsModels
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListEndpointsHeaders
Represents the Headers record for the operation: listEndpoints
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListEndpointsResponse
List of available endpoints for a model
Fields
- id string - Unique identifier for the model
- name string - Display name of the model
- created decimal - Unix timestamp of when the model was created
- description string - Description of the model
- architecture record { tokenizer ModelGroup, instruct_type InstructType, modality string, input_modalities InputModality[], output_modalities OutputModality[] } -
- endpoints PublicEndpoint[] - List of available endpoints for this model
openrouter: ListEndpointsZdrHeaders
Represents the Headers record for the operation: listEndpointsZdr
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListGuardrailKeyAssignmentsHeaders
Represents the Headers record for the operation: listGuardrailKeyAssignments
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListGuardrailKeyAssignmentsQueries
Represents the Queries record for the operation: listGuardrailKeyAssignments
Fields
- offset? string - Number of records to skip for pagination
- 'limit? string - Maximum number of records to return (max 100)
openrouter: ListGuardrailMemberAssignmentsHeaders
Represents the Headers record for the operation: listGuardrailMemberAssignments
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListGuardrailMemberAssignmentsQueries
Represents the Queries record for the operation: listGuardrailMemberAssignments
Fields
- offset? string - Number of records to skip for pagination
- 'limit? string - Maximum number of records to return (max 100)
openrouter: ListGuardrailsHeaders
Represents the Headers record for the operation: listGuardrails
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListGuardrailsQueries
Represents the Queries record for the operation: listGuardrails
Fields
- offset? string - Number of records to skip for pagination
- 'limit? string - Maximum number of records to return (max 100)
openrouter: ListHeaders
Represents the Headers record for the operation: list
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListKeyAssignmentsHeaders
Represents the Headers record for the operation: listKeyAssignments
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListKeyAssignmentsQueries
Represents the Queries record for the operation: listKeyAssignments
Fields
- offset? string - Number of records to skip for pagination
- 'limit? string - Maximum number of records to return (max 100)
openrouter: ListMemberAssignmentsHeaders
Represents the Headers record for the operation: listMemberAssignments
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListMemberAssignmentsQueries
Represents the Queries record for the operation: listMemberAssignments
Fields
- offset? string - Number of records to skip for pagination
- 'limit? string - Maximum number of records to return (max 100)
openrouter: ListModelsCountHeaders
Represents the Headers record for the operation: listModelsCount
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListModelsUserHeaders
Represents the Headers record for the operation: listModelsUser
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListProvidersHeaders
Represents the Headers record for the operation: listProviders
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: ListQueries
Represents the Queries record for the operation: list
Fields
- include_disabled? string - Whether to include disabled API keys in the response
- offset? string - Number of API keys to skip for pagination
openrouter: Model
Information about an AI model available on OpenRouter
Fields
- id string - Unique identifier for the model
- canonical_slug string - Canonical slug for the model
- hugging_face_id? string - Hugging Face model identifier, if applicable
- name string - Display name of the model
- created decimal - Unix timestamp of when the model was created
- description? string - Description of the model
- pricing PublicPricing - Pricing information for the model
- context_length decimal - Maximum context length in tokens
- architecture ModelArchitecture - Model architecture information
- top_provider TopProviderInfo - Information about the top provider for this model
- per_request_limits PerRequestLimits - Per-request token limits
- supported_parameters Parameter[] - List of supported parameters for this model
- default_parameters DefaultParameters - Default parameters for this model
- expiration_date? string - The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration.
openrouter: ModelArchitecture
Model architecture information
Fields
- tokenizer? ModelGroup - Tokenizer type used by the model
- instruct_type? "none"|"airoboros"|"alpaca"|"alpaca-modif"|"chatml"|"claude"|"code-llama"|"gemma"|"llama2"|"llama3"|"mistral"|"nemotron"|"neural"|"openchat"|"phi3"|"rwkv"|"vicuna"|"zephyr"|"deepseek-r1"|"deepseek-v3.1"|"qwq"|"qwen3" - Instruction format type
- modality string - Primary modality of the model
- input_modalities InputModality[] - Supported input modalities
- output_modalities OutputModality[] - Supported output modalities
openrouter: ModelEndpointsResponse
Fields
- data ListEndpointsResponse - List of available endpoints for a model
openrouter: ModelsCountResponse
Model count data
Fields
- data ModelsCountResponse_data - Model count data
openrouter: ModelsCountResponse_data
Model count data
Fields
- count decimal - Total number of available models
openrouter: ModelsListResponse
List of available models
Fields
- data ModelsListResponseData - List of available models
openrouter: NamedToolChoice
Named tool choice for specific function
Fields
- 'type "function" -
- 'function NamedToolChoice_function -
openrouter: NamedToolChoice_function
Fields
- name string - Function name to call
openrouter: OpenAIResponsesIncompleteDetails
Fields
- reason? "max_output_tokens"|"content_filter" -
openrouter: OpenAIResponsesNonStreamingResponse
Fields
- id string -
- 'object "response" -
- created_at decimal -
- model string -
- status OpenAIResponsesResponseStatus -
- completed_at decimal -
- user? string -
- output_text? string -
- prompt_cache_key? string -
- safety_identifier? string -
- 'error ResponsesErrorField - Error information returned from the API
- incomplete_details OpenAIResponsesIncompleteDetails -
- usage? OpenAIResponsesUsage -
- max_tool_calls? decimal -
- top_logprobs? decimal -
- max_output_tokens? decimal -
- temperature decimal -
- top_p decimal -
- presence_penalty decimal -
- frequency_penalty decimal -
- instructions OpenAIResponsesInput -
- metadata OpenResponsesRequestMetadata - Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
- tools (record {}|OpenResponsesWebSearchPreviewTool|OpenResponsesWebSearchPreview20250311Tool|OpenResponsesWebSearchTool|OpenResponsesWebSearch20250826Tool|OpenResponsesFileSearchTool|OpenResponsesComputerTool|OpenResponsesCodeInterpreterTool|OpenResponsesMcpTool|OpenResponsesImageGenerationTool|OpenResponsesLocalShellTool|OpenResponsesFunctionShellTool|OpenResponsesApplyPatchTool|OpenResponsesCustomTool)[] -
- tool_choice OpenAIResponsesToolChoice -
- parallel_tool_calls boolean -
- prompt? OpenAIResponsesPrompt -
- background? boolean -
- previous_response_id? string -
- reasoning? OpenAIResponsesReasoningConfig -
- service_tier? OpenAIResponsesServiceTier -
- store? boolean -
- truncation? OpenAIResponsesTruncation -
- text? ResponseTextConfig - Text output configuration including format and verbosity
openrouter: OpenAIResponsesPrompt
Fields
- id string -
- variables? record {} -
openrouter: OpenAIResponsesReasoningConfig
Fields
- effort? OpenAIResponsesReasoningEffort -
- summary? ReasoningSummaryVerbosity -
openrouter: OpenAIResponsesRefusalContent
Fields
- 'type "refusal" -
- refusal string -
openrouter: OpenAIResponsesUsage
Fields
- input_tokens decimal -
- input_tokens_details OpenAIResponsesUsage_input_tokens_details -
- output_tokens decimal -
- output_tokens_details OpenAIResponsesUsage_output_tokens_details -
- total_tokens decimal -
openrouter: OpenAIResponsesUsage_input_tokens_details
Fields
- cached_tokens decimal -
openrouter: OpenAIResponsesUsage_output_tokens_details
Fields
- reasoning_tokens decimal -
openrouter: OpenResponsesApplyPatchTool
Apply patch tool configuration
Fields
- 'type "apply_patch" -
openrouter: OpenResponsesCodeInterpreterTool
Code interpreter tool configuration
Fields
- 'type "code_interpreter" -
openrouter: OpenResponsesComputerTool
Computer use preview tool configuration
Fields
- 'type "computer_use_preview" -
- display_height decimal -
- display_width decimal -
- environment "windows"|"mac"|"linux"|"ubuntu"|"browser" -
openrouter: OpenResponsesCustomTool
Custom tool configuration
Fields
- 'type "custom" -
- name string -
- description? string -
- format? record { 'type "text" }|record { 'type "grammar" , definition string, syntax "lark"|"regex" } -
openrouter: OpenResponsesEasyInputMessage
Fields
- 'type? "message" -
- role "user"|"system"|"assistant"|"developer" -
- content? anydata -
- phase? anydata - The phase of an assistant message. Use
commentaryfor an intermediate assistant message andfinal_answerfor the final assistant message. For follow-up requests with models likegpt-5.3-codexand later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages.
openrouter: OpenResponsesFileSearchTool
File search tool configuration
Fields
- 'type "file_search" -
- vector_store_ids string[] -
- filters? anydata -
- max_num_results? int -
- ranking_options? OpenResponsesFileSearchTool_ranking_options -
openrouter: OpenResponsesFileSearchTool_ranking_options
Fields
- ranker? "auto"|"default-2024-11-15" -
- score_threshold? decimal -
openrouter: OpenResponsesFunctionCallOutput
The output from a function call execution
Fields
- 'type "function_call_output" -
- id? string -
- call_id string -
- output string|(ResponseInputText|record {}|ResponseInputFile)[] -
- status? ToolCallStatus -
openrouter: OpenResponsesFunctionShellTool
Shell tool configuration
Fields
- 'type "shell" -
openrouter: OpenResponsesFunctionTool
Function tool definition
Fields
- 'type "function" -
- name string -
- description? string -
- strict? boolean -
- parameters record {} -
openrouter: OpenResponsesFunctionToolCall
A function call initiated by the model
Fields
- 'type "function_call" -
- call_id string -
- name string -
- arguments string -
- id string -
- status? ToolCallStatus -
openrouter: OpenResponsesImageGenerationTool
Image generation tool configuration
Fields
- 'type "image_generation" -
- background? "transparent"|"opaque"|"auto" -
- input_fidelity? "high"|"low" -
- input_image_mask? OpenResponsesImageGenerationTool_input_image_mask -
- model? "gpt-image-1"|"gpt-image-1-mini" -
- moderation? "auto"|"low" -
- output_compression? decimal -
- output_format? "png"|"webp"|"jpeg" -
- partial_images? decimal -
- quality? "low"|"medium"|"high"|"auto" -
- size? "1024x1024"|"1024x1536"|"1536x1024"|"auto" -
openrouter: OpenResponsesImageGenerationTool_input_image_mask
Fields
- image_url? string -
- file_id? string -
openrouter: OpenResponsesInputMessageItem
Fields
- id? string -
- 'type? "message" -
- role "user"|"system"|"developer" -
- content? (ResponseInputText|record {}|ResponseInputFile|ResponseInputAudio|ResponseInputVideo)[] -
openrouter: OpenResponsesLocalShellTool
Local shell tool configuration
Fields
- 'type "local_shell" -
openrouter: OpenResponsesMcpTool
MCP (Model Context Protocol) tool configuration
Fields
- 'type "mcp" -
- server_label string -
- allowed_tools? anydata -
- authorization? string -
- connector_id? "connector_dropbox"|"connector_gmail"|"connector_googlecalendar"|"connector_googledrive"|"connector_microsoftteams"|"connector_outlookcalendar"|"connector_outlookemail"|"connector_sharepoint" -
- headers? record { string... } -
- require_approval? anydata -
- server_description? string -
- server_url? string -
openrouter: OpenResponsesNonStreamingResponse
Complete non-streaming response from the Responses API
Fields
- Fields Included from *OpenAIResponsesNonStreamingResponse
- id string
- object "response"
- created_at decimal
- model string
- status OpenAIResponsesResponseStatus
- completed_at decimal
- output OutputMessage|OutputItemReasoning|OutputItemFunctionCall|OutputItemWebSearchCall|OutputItemFileSearchCall|OutputItemImageGenerationCall[]
- user string
- output_text string
- prompt_cache_key string
- safety_identifier string
- error ResponsesErrorField
- incomplete_details OpenAIResponsesIncompleteDetails
- usage OpenAIResponsesUsage
- max_tool_calls decimal
- top_logprobs decimal
- max_output_tokens decimal
- temperature decimal
- top_p decimal
- presence_penalty decimal
- frequency_penalty decimal
- instructions OpenAIResponsesInput
- metadata OpenResponsesRequestMetadata
- tools record { type "function", name string, description string, strict boolean, parameters record { anydata... }, anydata... }|OpenResponsesWebSearchPreviewTool|OpenResponsesWebSearchPreview20250311Tool|OpenResponsesWebSearchTool|OpenResponsesWebSearch20250826Tool|OpenResponsesFileSearchTool|OpenResponsesComputerTool|OpenResponsesCodeInterpreterTool|OpenResponsesMcpTool|OpenResponsesImageGenerationTool|OpenResponsesLocalShellTool|OpenResponsesFunctionShellTool|OpenResponsesApplyPatchTool|OpenResponsesCustomTool[]
- tool_choice OpenAIResponsesToolChoice
- parallel_tool_calls boolean
- prompt OpenAIResponsesPrompt
- background boolean
- previous_response_id string
- reasoning OpenAIResponsesReasoningConfig
- service_tier OpenAIResponsesServiceTier
- store boolean
- truncation OpenAIResponsesTruncation
- text ResponseTextConfig
- anydata...
- output? ResponsesOutputItem[] -
- usage? OpenResponsesUsage -
openrouter: OpenResponsesReasoning
Reasoning output item with signature and format extensions
Fields
- Fields Included from *OutputItemReasoning
- type "reasoning"
- id string
- content ReasoningTextContent[]
- summary ReasoningSummaryText[]
- encrypted_content string
- status "completed"|"incomplete"|"in_progress"
- anydata...
- content? ReasoningTextContent[] -
- signature? string -
- format? "unknown"|"openai-responses-v1"|"azure-openai-responses-v1"|"xai-responses-v1"|"anthropic-claude-v1"|"google-gemini-v1" -
openrouter: OpenResponsesReasoningConfig
Configuration for reasoning mode in the response
Fields
- Fields Included from *OpenAIResponsesReasoningConfig
- effort OpenAIResponsesReasoningEffort
- summary ReasoningSummaryVerbosity
- anydata...
- max_tokens? decimal -
- enabled? boolean -
openrouter: OpenResponsesRequest
Request schema for Responses endpoint
Fields
- input? OpenResponsesInput - Input for a response request - can be a string or array of items
- instructions? string -
- metadata? OpenResponsesRequestMetadata - Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
- tools? (record {}|OpenResponsesWebSearchPreviewTool|OpenResponsesWebSearchPreview20250311Tool|OpenResponsesWebSearchTool|OpenResponsesWebSearch20250826Tool|OpenResponsesFileSearchTool|OpenResponsesComputerTool|OpenResponsesCodeInterpreterTool|OpenResponsesMcpTool|OpenResponsesImageGenerationTool|OpenResponsesLocalShellTool|OpenResponsesFunctionShellTool|OpenResponsesApplyPatchTool|OpenResponsesCustomTool)[] -
- tool_choice? OpenAIResponsesToolChoice -
- parallel_tool_calls? boolean -
- model? string -
- models? string[] -
- text? OpenResponsesResponseText - Text output configuration including format and verbosity
- reasoning? OpenResponsesReasoningConfig - Configuration for reasoning mode in the response
- max_output_tokens? decimal -
- temperature? decimal -
- top_p? decimal -
- top_logprobs? int -
- max_tool_calls? int -
- presence_penalty? decimal -
- frequency_penalty? decimal -
- top_k? decimal -
- image_config? record {} - Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details.
- modalities? ResponsesOutputModality[] - Output modalities for the response. Supported values are "text" and "image".
- prompt_cache_key? string -
- previous_response_id? string -
- prompt? OpenAIResponsesPrompt -
- include? OpenAIResponsesIncludable[] -
- background? boolean -
- safety_identifier? string -
- store boolean(default false) -
- service_tier "auto" (default "auto") -
- truncation? OpenAIResponsesTruncation -
- 'stream boolean(default false) -
- provider? OpenResponsesRequest_provider - When multiple model providers are available, optionally indicate your routing preference.
- plugins? (record { id "auto-router" , enabled boolean, allowed_models string[] }|record { id "moderation" }|record { id "web" , enabled boolean, max_results decimal, search_prompt string, engine WebSearchEngine, native_tool_version "web_search_20250305"|"web_search_20260209" , include_domains string[], exclude_domains string[] }|record { id "file-parser" , enabled boolean, pdf PDFParserOptions }|record { id "response-healing" , enabled boolean })[] - Plugins you want to enable for this request, including their settings.
- route? "fallback"|"sort" - DEPRECATED Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
- user? string - A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
- session_id? string - A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
- trace? OpenResponsesRequest_trace - Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
openrouter: OpenResponsesRequest_provider
When multiple model providers are available, optionally indicate your routing preference.
Fields
- allow_fallbacks? boolean - Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
- require_parameters? boolean - Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
- data_collection? DataCollection - Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
- zdr? boolean - Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
- enforce_distillable_text? boolean - Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
- 'order? (ProviderName|string)[] - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
- only? (ProviderName|string)[] - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
- ignore? (ProviderName|string)[] - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
- quantizations? Quantization[] - A list of quantization levels to filter the provider by.
- sort? anydata - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
- max_price? OpenResponsesRequest_provider_max_price - The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
- preferred_min_throughput? PreferredMinThroughput - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
- preferred_max_latency? PreferredMaxLatency - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
openrouter: OpenResponsesRequest_provider_max_price
The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
Fields
- prompt? BigNumberUnion - Price per million prompt tokens
- completion? BigNumberUnion -
- image? BigNumberUnion -
- audio? BigNumberUnion -
- request? BigNumberUnion -
openrouter: OpenResponsesRequest_trace
Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
Fields
- trace_id? string -
- trace_name? string -
- span_name? string -
- generation_name? string -
- parent_span_id? string -
openrouter: OpenResponsesRequestMetadata
Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
Fields
- string... - Rest field
openrouter: OpenResponsesResponseText
Text output configuration including format and verbosity
Fields
- Fields Included from *ResponseTextConfig
- format ResponseFormatTextConfig
- verbosity "high"|"low"|"medium"
- anydata...
openrouter: OpenResponsesUsage
Token usage information for the response
Fields
- Fields Included from *OpenAIResponsesUsage
- input_tokens decimal
- input_tokens_details OpenAIResponsesUsage_input_tokens_details
- output_tokens decimal
- output_tokens_details OpenAIResponsesUsage_output_tokens_details
- total_tokens decimal
- anydata...
- cost? decimal -
- is_byok? boolean -
openrouter: OpenResponsesWebSearch20250826Tool
Web search tool configuration (2025-08-26 version)
Fields
- 'type "web_search_2025_08_26" -
- filters? OpenResponsesWebSearchTool_filters -
- search_context_size? ResponsesSearchContextSize - Size of the search context for web search tools
- user_location? ResponsesWebSearchUserLocation - User location information for web search
openrouter: OpenResponsesWebSearchPreview20250311Tool
Web search preview tool configuration (2025-03-11 version)
Fields
- 'type "web_search_preview_2025_03_11" -
- search_context_size? ResponsesSearchContextSize - Size of the search context for web search tools
- user_location? WebSearchPreviewToolUserLocation -
openrouter: OpenResponsesWebSearchPreviewTool
Web search preview tool configuration
Fields
- 'type "web_search_preview" -
- search_context_size? ResponsesSearchContextSize - Size of the search context for web search tools
- user_location? WebSearchPreviewToolUserLocation -
openrouter: OpenResponsesWebSearchTool
Web search tool configuration
Fields
- 'type "web_search" -
- filters? OpenResponsesWebSearchTool_filters -
- search_context_size? ResponsesSearchContextSize - Size of the search context for web search tools
- user_location? ResponsesWebSearchUserLocation - User location information for web search
openrouter: OpenResponsesWebSearchTool_filters
Fields
- allowed_domains? string[] -
openrouter: OpenRouterAnthropicMessageParam
Anthropic message with OpenRouter extensions
Fields
- role "user"|"assistant" -
- content anydata -
openrouter: OutputItemFileSearchCall
Fields
- 'type "file_search_call" -
- id string -
- queries string[] -
- status WebSearchStatus -
openrouter: OutputItemFunctionCall
Fields
- 'type "function_call" -
- id? string -
- name string -
- arguments string -
- call_id string -
- status? "completed"|"incomplete"|"in_progress" -
openrouter: OutputItemImageGenerationCall
Fields
- 'type "image_generation_call" -
- id string -
- result? string -
- status ImageGenerationStatus -
openrouter: OutputItemReasoning
Fields
- 'type "reasoning" -
- id string -
- content? ReasoningTextContent[] -
- summary ReasoningSummaryText[] -
- encrypted_content? string -
- status? "completed"|"incomplete"|"in_progress" -
openrouter: OutputItemWebSearchCall
Fields
- 'type "web_search_call" -
- id string -
- status WebSearchStatus -
openrouter: OutputMessage
Fields
- id string -
- role "assistant" -
- 'type "message" -
- status? "completed"|"incomplete"|"in_progress" -
- content (ResponseOutputText|OpenAIResponsesRefusalContent)[] -
- phase? anydata - The phase of an assistant message. Use
commentaryfor an intermediate assistant message andfinal_answerfor the final assistant message. For follow-up requests with models likegpt-5.3-codexand later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages.
openrouter: PDFParserOptions
Options for PDF parsing.
Fields
- engine? PDFParserEngine - The engine to use for parsing PDF files.
openrouter: PercentileLatencyCutoffs
Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
Fields
- p50? decimal - Maximum p50 latency (seconds)
- p75? decimal - Maximum p75 latency (seconds)
- p90? decimal - Maximum p90 latency (seconds)
- p99? decimal - Maximum p99 latency (seconds)
openrouter: PercentileStats
Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests.
Fields
- p50 decimal - Median (50th percentile)
- p75 decimal - 75th percentile
- p90 decimal - 90th percentile
- p99 decimal - 99th percentile
openrouter: PercentileThroughputCutoffs
Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred.
Fields
- p50? decimal - Minimum p50 throughput (tokens/sec)
- p75? decimal - Minimum p75 throughput (tokens/sec)
- p90? decimal - Minimum p90 throughput (tokens/sec)
- p99? decimal - Minimum p99 throughput (tokens/sec)
openrouter: PerRequestLimits
Per-request token limits
Fields
- prompt_tokens decimal - Maximum prompt tokens per request
- completion_tokens decimal - Maximum completion tokens per request
openrouter: ProviderPreferences
Provider routing preferences for the request.
Fields
- allow_fallbacks? boolean - Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
- require_parameters? boolean - Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
- data_collection? DataCollection - Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
- zdr? boolean - Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
- enforce_distillable_text? boolean - Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
- 'order? (ProviderName|string)[] - An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
- only? (ProviderName|string)[] - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
- ignore? (ProviderName|string)[] - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
- quantizations? Quantization[] - A list of quantization levels to filter the provider by.
- sort? ProviderSort -
- max_price? OpenResponsesRequest_provider_max_price - The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
- preferred_min_throughput? PreferredMinThroughput - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
- preferred_max_latency? PreferredMaxLatency - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
openrouter: ProviderSortConfig
The provider sorting strategy (price, throughput, latency)
Fields
- 'by? "price"|"throughput"|"latency" - The provider sorting strategy (price, throughput, latency)
- partition? "model"|"none" - Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
openrouter: ProvidersResponse
Fields
openrouter: PublicEndpoint
Information about a specific model endpoint
Fields
- name string -
- model_id string - The unique identifier for the model (permaslug)
- model_name string -
- context_length decimal -
- pricing PublicEndpoint_pricing -
- provider_name ProviderName -
- tag string -
- quantization Quantization -
- max_completion_tokens decimal -
- max_prompt_tokens decimal -
- supported_parameters Parameter[] -
- status? EndpointStatus -
- uptime_last_30m decimal -
- supports_implicit_caching boolean -
- latency_last_30m PercentileStats - Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests.
- throughput_last_30m PercentileStats -
openrouter: PublicEndpoint_pricing
Fields
- prompt BigNumberUnion -
- completion BigNumberUnion -
- request? BigNumberUnion -
- image? BigNumberUnion -
- image_token? BigNumberUnion -
- image_output? BigNumberUnion -
- audio? BigNumberUnion -
- audio_output? BigNumberUnion -
- input_audio_cache? BigNumberUnion -
- web_search? BigNumberUnion -
- internal_reasoning? BigNumberUnion -
- input_cache_read? BigNumberUnion -
- input_cache_write? BigNumberUnion -
- discount? decimal -
openrouter: PublicPricing
Pricing information for the model
Fields
- prompt BigNumberUnion -
- completion BigNumberUnion -
- request? BigNumberUnion -
- image? BigNumberUnion -
- image_token? BigNumberUnion -
- image_output? BigNumberUnion -
- audio? BigNumberUnion -
- audio_output? BigNumberUnion -
- input_audio_cache? BigNumberUnion -
- web_search? BigNumberUnion -
- internal_reasoning? BigNumberUnion -
- input_cache_read? BigNumberUnion -
- input_cache_write? BigNumberUnion -
- discount? decimal -
openrouter: ReasoningDetailEncrypted
Reasoning detail encrypted schema
Fields
- 'type "reasoning.encrypted" -
- data string -
- id? string -
- format? "unknown"|"openai-responses-v1"|"azure-openai-responses-v1"|"xai-responses-v1"|"anthropic-claude-v1"|"google-gemini-v1" -
- index? decimal -
openrouter: ReasoningDetailSummary
Reasoning detail summary schema
Fields
- 'type "reasoning.summary" -
- summary string -
- id? string -
- format? "unknown"|"openai-responses-v1"|"azure-openai-responses-v1"|"xai-responses-v1"|"anthropic-claude-v1"|"google-gemini-v1" -
- index? decimal -
openrouter: ReasoningDetailText
Reasoning detail text schema
Fields
- 'type "reasoning.text" -
- text? string -
- signature? string -
- id? string -
- format? "unknown"|"openai-responses-v1"|"azure-openai-responses-v1"|"xai-responses-v1"|"anthropic-claude-v1"|"google-gemini-v1" -
- index? decimal -
openrouter: ReasoningSummaryText
Fields
- 'type "summary_text" -
- text string -
openrouter: ReasoningTextContent
Fields
- 'type "reasoning_text" -
- text string -
openrouter: RemoveKeysRequest
Fields
- key_hashes RemoveKeyHash[] - Array of API key hashes to unassign from the guardrail
openrouter: RemoveKeysResponse
Fields
- unassigned_count decimal - Number of keys successfully unassigned
openrouter: RemoveMembersRequest
Fields
- member_user_ids RemoveMemberUserId[] - Array of member user IDs to unassign from the guardrail
openrouter: RemoveMembersResponse
Fields
- unassigned_count decimal - Number of members successfully unassigned
openrouter: ResponseFormatJSONObject
JSON object response format
Fields
- 'type "json_object" -
openrouter: ResponseFormatJSONSchema
JSON Schema response format for structured outputs
Fields
- 'type "json_schema" -
- json_schema JSONSchemaConfig - JSON Schema configuration object
openrouter: ResponseFormatText
Default text response format
Fields
- 'type "text" -
openrouter: ResponseFormatTextGrammar
Custom grammar response format
Fields
- 'type "grammar" -
- grammar string - Custom grammar for text generation
openrouter: ResponseFormatTextPython
Python code response format
Fields
- 'type "python" -
openrouter: ResponseInputAudio
Audio input content item
Fields
- 'type "input_audio" -
- input_audio ResponseInputAudio_input_audio -
openrouter: ResponseInputAudio_input_audio
Fields
- data string -
- format "mp3"|"wav" -
openrouter: ResponseInputFile
File input content item
Fields
- 'type "input_file" -
- file_id? string -
- file_data? string -
- filename? string -
- file_url? string -
openrouter: ResponseInputImage
Image input content item
Fields
- 'type "input_image" -
- detail "auto"|"high"|"low" -
- image_url? string -
openrouter: ResponseInputText
Text input content item
Fields
- 'type "input_text" -
- text string -
openrouter: ResponseInputVideo
Video input content item
Fields
- 'type "input_video" -
- video_url string - A base64 data URL or remote URL that resolves to a video file
openrouter: ResponseOutputText
Fields
- 'type "output_text" -
- text string -
- annotations? OpenAIResponsesAnnotation[] -
openrouter: ResponsesErrorField
Error information returned from the API
Fields
- code "server_error"|"rate_limit_exceeded"|"invalid_prompt"|"vector_store_timeout"|"invalid_image"|"invalid_image_format"|"invalid_base64_image"|"invalid_image_url"|"image_too_large"|"image_too_small"|"image_parse_error"|"image_content_policy_violation"|"invalid_image_mode"|"image_file_too_large"|"unsupported_image_media_type"|"empty_image_file"|"failed_to_download_image"|"image_file_not_found" -
- message string -
openrouter: ResponsesFormatText
Plain text response format
Fields
- 'type "text" -
openrouter: ResponsesFormatTextJSONSchemaConfig
JSON schema constrained response format
Fields
- 'type "json_schema" -
- name string -
- description? string -
- strict? boolean -
- schema record {} -
openrouter: ResponsesImageGenerationCall
Fields
- Fields Included from *OutputItemImageGenerationCall
- type "image_generation_call"
- id string
- result string
- status ImageGenerationStatus
- anydata...
openrouter: ResponsesOutputItemFileSearchCall
Fields
- Fields Included from *OutputItemFileSearchCall
- type "file_search_call"
- id string
- queries string[]
- status WebSearchStatus
- anydata...
openrouter: ResponsesOutputItemFunctionCall
Fields
- Fields Included from *OutputItemFunctionCall
openrouter: ResponsesOutputItemReasoning
An output item containing reasoning
Fields
- Fields Included from *OutputItemReasoning
- type "reasoning"
- id string
- content ReasoningTextContent[]
- summary ReasoningSummaryText[]
- encrypted_content string
- status "completed"|"incomplete"|"in_progress"
- anydata...
- content? ReasoningTextContent[] -
- signature? string -
- format? "unknown"|"openai-responses-v1"|"azure-openai-responses-v1"|"xai-responses-v1"|"anthropic-claude-v1"|"google-gemini-v1" -
openrouter: ResponsesOutputMessage
An output message item
Fields
- Fields Included from *OutputMessage
- id string
- role "assistant"
- type "message"
- status "completed"|"incomplete"|"in_progress"
- content ResponseOutputText|OpenAIResponsesRefusalContent[]
- phase anydata
- anydata...
openrouter: ResponsesWebSearchCallOutput
Fields
- Fields Included from *OutputItemWebSearchCall
- type "web_search_call"
- id string
- action record { type "search", query string, queries string[], sources record { type "url", url string, anydata... }[], anydata... }|record { type "open_page", url string, anydata... }|record { type "find_in_page", pattern string, url string, anydata... }
- status WebSearchStatus
- anydata...
openrouter: ResponsesWebSearchUserLocation
User location information for web search
Fields
- 'type? "approximate" -
- city? string -
- country? string -
- region? string -
- timezone? string -
openrouter: ResponseTextConfig
Text output configuration including format and verbosity
Fields
- format? ResponseFormatTextConfig - Text response format configuration
- verbosity? "high"|"low"|"medium" -
openrouter: SendChatCompletionRequestHeaders
Represents the Headers record for the operation: sendChatCompletionRequest
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: SystemMessage
System message for setting behavior
Fields
- role "system" -
- content string|ChatMessageContentItemText[] - System message content
- name? string - Optional name for the system message
openrouter: ToolDefinitionJson
Tool definition for function calling
Fields
- 'type "function" -
- 'function ToolDefinitionJson_function - Function definition for tool calling
- cache_control? ChatMessageContentItemCacheControl - Cache control for the content part
openrouter: ToolDefinitionJson_function
Function definition for tool calling
Fields
- name string - Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)
- description? string - Function description for the model
- parameters? record {} - Function parameters as JSON Schema object
- strict? boolean - Enable strict schema adherence
openrouter: ToolResponseMessage
Tool response message
Fields
- role "tool" -
- content string|ChatMessageContentItem[] - Tool response content
- tool_call_id string - ID of the assistant message tool call this message responds to
openrouter: TopProviderInfo
Information about the top provider for this model
Fields
- context_length? decimal - Context length from the top provider
- max_completion_tokens? decimal - Maximum completion tokens from the top provider
- is_moderated boolean - Whether the top provider moderates content
openrouter: UpdatedApiKeyInfo
The updated API key information
Fields
- hash string - Unique hash identifier for the API key
- name string - Name of the API key
- label string - Human-readable label for the API key
- disabled boolean - Whether the API key is disabled
- 'limit decimal - Spending limit for the API key in USD
- limit_remaining decimal - Remaining spending limit in USD
- limit_reset string - Type of limit reset for the API key
- include_byok_in_limit boolean - Whether to include external BYOK usage in the credit limit
- usage decimal - Total OpenRouter credit usage (in USD) for the API key
- usage_daily decimal - OpenRouter credit usage (in USD) for the current UTC day
- usage_weekly decimal - OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
- usage_monthly decimal - OpenRouter credit usage (in USD) for the current UTC month
- byok_usage decimal - Total external BYOK usage (in USD) for the API key
- byok_usage_daily decimal - External BYOK usage (in USD) for the current UTC day
- byok_usage_weekly decimal - External BYOK usage (in USD) for the current UTC week (Monday-Sunday)
- byok_usage_monthly decimal - External BYOK usage (in USD) for current UTC month
- created_at string - ISO 8601 timestamp of when the API key was created
- updated_at string - ISO 8601 timestamp of when the API key was last updated
- expires_at? string - ISO 8601 UTC timestamp when the API key expires, or null if no expiration
openrouter: UpdatedGuardrailData
The updated guardrail
Fields
- id string - Unique identifier for the guardrail
- name string - Name of the guardrail
- description? string - Description of the guardrail
- limit_usd? decimal - Spending limit in USD
- reset_interval? "daily"|"weekly"|"monthly" - Interval at which the limit resets (daily, weekly, monthly)
- allowed_providers? string[] - List of allowed provider IDs
- ignored_providers? string[] - List of provider IDs to exclude from routing
- allowed_models? string[] - Array of model canonical_slugs (immutable identifiers)
- enforce_zdr? boolean - Whether to enforce zero data retention
- created_at string - ISO 8601 timestamp of when the guardrail was created
- updated_at? string - ISO 8601 timestamp of when the guardrail was last updated
openrouter: UpdateGuardrailHeaders
Represents the Headers record for the operation: updateGuardrail
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: UpdateGuardrailRequest
Fields
- name? string - New name for the guardrail
- description? string - New description for the guardrail
- limit_usd? decimal - New spending limit in USD
- reset_interval? "daily"|"weekly"|"monthly" - Interval at which the limit resets (daily, weekly, monthly)
- allowed_providers? string[] - New list of allowed provider IDs
- ignored_providers? string[] - List of provider IDs to exclude from routing
- allowed_models? string[] - Array of model identifiers (slug or canonical_slug accepted)
- enforce_zdr? boolean - Whether to enforce zero data retention
openrouter: UpdateGuardrailResponse
Fields
- data UpdatedGuardrailData - The updated guardrail
openrouter: UpdateKeyRequest
Fields
- name? string - New name for the API key
- disabled? boolean - Whether to disable the API key
- 'limit? decimal - New spending limit for the API key in USD
- limit_reset? "daily"|"weekly"|"monthly" - New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
- include_byok_in_limit? boolean - Whether to include BYOK usage in the limit
openrouter: UpdateKeyResponse
Fields
- data UpdatedApiKeyInfo - The updated API key information
openrouter: UpdateKeysHeaders
Represents the Headers record for the operation: updateKeys
Fields
- X\-OpenRouter\-Categories? string - Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
- HTTP\-Referer? string - The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application.
- X\-OpenRouter\-Title? string - The app display name allows you to customize how your app appears in OpenRouter's dashboard.
openrouter: URLCitation
Fields
- 'type "url_citation" -
- url string -
- title string -
- start_index decimal -
- end_index decimal -
openrouter: UserMessage
User message
Fields
- role "user" -
- content string|ChatMessageContentItem[] - User message content
- name? string - Optional name for the user
openrouter: VideoInput
Video input object
Fields
- url string - URL of the video (data: URLs supported)
openrouter: Web3Data
Fields
- transfer_intent Web3TransferIntent -
openrouter: Web3TransferIntent
Fields
- call_data Web3TransferIntentCallData -
- metadata Web3TransferIntentMetadata -
openrouter: Web3TransferIntentCallData
Fields
- deadline string -
- fee_amount string -
- id string -
- operator string -
- prefix string -
- recipient string -
- recipient_amount string -
- recipient_currency string -
- refund_destination string -
- signature string -
openrouter: Web3TransferIntentMetadata
Fields
- chain_id decimal -
- contract_address string -
- sender string -
openrouter: WebSearchPreviewToolUserLocation
Fields
- 'type "approximate" -
- city? string -
- country? string -
- region? string -
- timezone? string -
openrouter: ZdrEndpointsResponse
Fields
- data PublicEndpoint[] -
Union types
openrouter: ModelGroup
ModelGroup
Tokenizer type used by the model
openrouter: OutputModality
OutputModality
openrouter: WebSearchStatus
WebSearchStatus
openrouter: OpenAIResponsesResponseStatus
OpenAIResponsesResponseStatus
openrouter: ToolCallStatus
ToolCallStatus
openrouter: PDFParserEngine
PDFParserEngine
The engine to use for parsing PDF files.
openrouter: Parameter
Parameter
openrouter: ResponsesOutputModality
ResponsesOutputModality
openrouter: ChatCompletionFinishReason
ChatCompletionFinishReason
openrouter: ChatMessageContentItem
ChatMessageContentItem
Content part for chat completion messages
openrouter: ReasoningDetailUnion
ReasoningDetailUnion
Reasoning detail union schema
openrouter: OpenAIResponsesAnnotation
OpenAIResponsesAnnotation
openrouter: DataCollection
DataCollection
Data collection setting. If no available model provider meets the requirement, your request will return an error.
-
allow: (default) allow providers which store user data non-transiently and may train on it
-
deny: use only providers which do not collect user data.
openrouter: ResponseFormatTextConfig
ResponseFormatTextConfig
Text response format configuration
openrouter: ResponsesOutputItem
ResponsesOutputItem
An output item from the response
openrouter: Quantization
Quantization
openrouter: ProviderName
ProviderName
openrouter: OpenAIResponsesServiceTier
OpenAIResponsesServiceTier
openrouter: OpenAIResponsesToolChoice
OpenAIResponsesToolChoice
openrouter: ImageGenerationStatus
ImageGenerationStatus
openrouter: InstructType
InstructType
Instruction format type
openrouter: OpenAIResponsesIncludable
OpenAIResponsesIncludable
openrouter: ToolChoiceOption
ToolChoiceOption
Tool choice configuration
openrouter: ResponsesSearchContextSize
ResponsesSearchContextSize
Size of the search context for web search tools
openrouter: ProviderSort
ProviderSort
The provider sorting strategy (price, throughput, latency)
openrouter: InputModality
InputModality
openrouter: OpenAIResponsesTruncation
OpenAIResponsesTruncation
openrouter: WebSearchEngine
WebSearchEngine
The search engine to use for web search.
openrouter: EndpointStatus
EndpointStatus
openrouter: Message
Message
Chat completion message with role-based discrimination
openrouter: OpenAIResponsesReasoningEffort
OpenAIResponsesReasoningEffort
openrouter: ReasoningSummaryVerbosity
ReasoningSummaryVerbosity
Array types
openrouter: ModelsListResponseData
ModelsListResponseData
List of available models
openrouter: AssistantMessageReasoningDetails
AssistantMessageReasoningDetails
Reasoning details for extended thinking models
openrouter: ModelNames
ModelNames
Models to use for completion
openrouter: AssistantMessageImages
AssistantMessageImages
Generated images from image generation models
Anydata types
openrouter: PreferredMaxLatency
PreferredMaxLatency
Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
openrouter: OpenAIResponsesInput
OpenAIResponsesInput
openrouter: PreferredMinThroughput
PreferredMinThroughput
Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
openrouter: OpenResponsesInput
OpenResponsesInput
Input for a response request - can be a string or array of items
String types
openrouter: BigNumberUnion
BigNumberUnion
Price per million prompt tokens
openrouter: AssignMemberUserId
AssignMemberUserId
openrouter: RemoveMemberUserId
RemoveMemberUserId
openrouter: ModelName
ModelName
Model to use for completion
openrouter: RemoveKeyHash
RemoveKeyHash
openrouter: AssignKeyHash
AssignKeyHash
Import
import ballerinax/openrouter;Other versions
1.0.0
Metadata
Released date: 16 days ago
Version: 1.0.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.12.0
GraalVM compatible: Yes
Pull count
Total: 158
Current verison: 158
Weekly downloads
Keywords
Agent
Model
Provider
Vendor/OpenRouter
Area/AI
Type/Connector
Contributors
Dependents