Model discovery
GET /v1/models returns the Onehop model catalog in an OpenAI-compatible list shape. Every item keeps the OpenAI core fields id, object, and owned_by, so strict clients can read data[].id without understanding the richer fields.
Use an API key, but this endpoint does not create usage records, charge credits, or forward requests to model providers.
curl https://api.onehop.ai/v1/models \ -H "Authorization: Bearer $ONEHOP_API_KEY"OpenAI SDK
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.ONEHOP_API_KEY, baseURL: "https://api.onehop.ai/v1",});
const models = await client.models.list();console.log(models.data.map((model) => model.id));For the strict OpenAI-compatible shape:
curl "https://api.onehop.ai/v1/models?compat=openai" \ -H "Authorization: Bearer $ONEHOP_API_KEY"cc-switch
cc-switch-style clients can auto-detect Onehop through the standard OpenAI-compatible endpoint. They only need data[].id, which is always the canonical Onehop model slug such as openai/gpt-5.5.
curl "https://api.onehop.ai/v1/models?compat=openai" \ -H "Authorization: Bearer $ONEHOP_API_KEY" \ | jq -r ".data[].id"OpenRouter-Style Fields
Use compat=openrouter when you want pricing, architecture, top_provider, and supported_parameters.
curl "https://api.onehop.ai/v1/models?compat=openrouter&supported_parameter=tools" \ -H "Authorization: Bearer $ONEHOP_API_KEY"pricing is exposed as per-token strings for ecosystem compatibility. Onehop’s authoritative billing truth is under onehop.pricing.our; onehop.pricing.official is only a reference price.
ZenMux-Style Fields
Use compat=zenmux when you want grouped pricings such as prompt, completion, input_cache_read, image, video, or audio.
curl "https://api.onehop.ai/v1/models?compat=zenmux&input_modality=image" \ -H "Authorization: Bearer $ONEHOP_API_KEY"Anthropic-Compatible List
Anthropic-compatible model discovery is available at /anthropic/v1/models. It lists only models that support the Anthropic Messages protocol.
curl https://api.onehop.ai/anthropic/v1/models \ -H "x-api-key: $ONEHOP_API_KEY"Query Parameters
Common filters:
q: search by id, provider, summary, or aliasid: exact model id, alias, or provider model idproviderorowned_by: provider slugprotocol:openai_chat,openai_responses,anthropic_messages,openai_images,openai_sora, orgoogle_vertex_aicapability: for examplereasoning,tool_calling,vision, orimage_generationinput_modality/output_modality: for exampletext,image,audio, orvideosupported_parameter: for exampletools,temperature,reasoning, ormax_tokens
Pagination and sorting:
limit: default100, max500cursor: cursor returned asnext_cursorsort:display_order,id,created_desc,context_desc,price_prompt_asc, orprice_completion_asc
Field control:
compat:onehopdefault,openai,openrouter,zenmux, oranthropicinclude: comma-separatedpricing,official_pricing,capabilities,protocols, oraliases