docs(openapi): align GET /models examples and parameter semantics#135
docs(openapi): align GET /models examples and parameter semantics#135akhilmmenon wants to merge 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the OpenAPI spec for GET /models so the documented query parameters and generated code samples reflect the endpoint’s current filtering and pagination semantics (notably using ai_service for filtering by AI service rather than provider).
Changes:
- Clarified
GET /modelsquery parameter semantics forai_service,provider,limit,offset, andsort. - Updated
x-code-samples(cURL, Pythonextra_query, JSclient.models.list) to filter viaai_service=openaiinstead ofprovider=openai.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: ai_service | ||
| required: false | ||
| description: Filter models by the AI service (e.g., 'openai', 'anthropic'). | ||
| description: Filter models by AI service (e.g., 'openai', 'anthropic'). |
There was a problem hiding this comment.
Minor consistency: this description uses single quotes around example values ('openai', 'anthropic'), but most other parameter descriptions in this spec either omit quotes or use backticks for inline code (e.g., "AI provider organization (e.g., openai, anthropic)" at openapi.yaml:33920). Consider aligning the formatting to match the rest of the document.
| label: Self-Hosted | ||
| source: | | ||
| # Example of sending a query parameter in the URL | ||
| curl 'https://YOUR_SELF_HOSTED_URL/models?provider=openai' \ | ||
| curl 'https://YOUR_SELF_HOSTED_URL/models?ai_service=openai' \ | ||
| -H "x-portkey-api-key: $PORTKEY_API_KEY" |
There was a problem hiding this comment.
The self-hosted samples use a different placeholder (YOUR_SELF_HOSTED_URL) than the rest of the spec and the declared DataPlaneServers (SELF_HOSTED_GATEWAY_URL). Consider switching these self-hosted examples to SELF_HOSTED_GATEWAY_URL for consistency (this placeholder also appears in the adjacent Python/JS self-hosted samples at openapi.yaml:5103 and :5135).
Description
This PR updates the OpenAPI spec for
GET /modelsto match the current models API behavior and avoid confusion in generated docs/examples.What changed
x-code-samplesto useai_service=openaiinstead ofprovider=openai:extra_query)client.models.list)ai_service: AI service(e.g.openai,anthropic)provider: virtual key slug (provider segment in@provider/model)limit: maximum models returned per page/requestoffset: number of models to skip before collecting resultssort: clarified thatprovidersort refers to virtual key slugWhy
The previous docs examples implied filtering with
provider=openai, which conflicted with intended semantics and caused implementation/documentation mismatch. This update ensures docs and API behavior stay consistent and reduces integration errors for users.Validation
GET /modelsparameter block and all code samples render with updated query params.