### Quick start installation on macOS/Linux Source: https://docs.requesty.ai/integrations/requesty-cli Run this command to download and install the Requesty CLI. The installer places the binary in ~/.requesty/bin and adds it to your PATH. ```bash curl -fsSL https://raw.githubusercontent.com/requestyai/cli/main/install.sh | sh ``` -------------------------------- ### EU Routing Quick Start Examples Source: https://docs.requesty.ai/features/eu-routing Code examples for using the EU routing endpoint with different SDKs and cURL. ```python import openai client = openai.OpenAI( api_key="YOUR_REQUESTY_API_KEY", base_url="https://router.eu.requesty.ai/v1", # EU endpoint ) response = client.chat.completions.create( model="bedrock/claude-sonnet-4-5-v2@eu-central-1", # EU model messages=[{"role": "user", "content": "Hello from Europe!"}] ) print(response.choices[0].message.content) ``` ```typescript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'YOUR_REQUESTY_API_KEY', baseURL: 'https://router.eu.requesty.ai/v1', // EU endpoint }); const response = await client.chat.completions.create({ model: 'bedrock/claude-sonnet-4-5-v2@eu-central-1', // EU model messages: [{ role: 'user', content: 'Hello from Europe!' }], }); console.log(response.choices[0].message); ``` ```python import anthropic client = anthropic.Anthropic( api_key="YOUR_REQUESTY_API_KEY", base_url="https://router.eu.requesty.ai", # EU endpoint (no /v1) ) message = client.messages.create( model="bedrock/claude-sonnet-4-5-v2@eu-central-1", # EU model max_tokens=1024, messages=[{"role": "user", "content": "Hello from Europe!"}] ) print(message.content[0].text) ``` ```bash curl https://router.eu.requesty.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "bedrock/claude-sonnet-4-5-v2@eu-central-1", "messages": [{"role": "user", "content": "Hello from Europe!"}] }' ``` -------------------------------- ### Install OpenAI SDK (Python) Source: https://docs.requesty.ai/quickstart Installs the openai Python package, which is required for the Python example. ```bash pip install openai ``` -------------------------------- ### Install OpenAI SDK (TypeScript) Source: https://docs.requesty.ai/quickstart Installs the openai npm package, which is required for the TypeScript example. ```bash npm install openai ``` -------------------------------- ### Basic Streaming Setup in Python Source: https://docs.requesty.ai/features/streaming Enable streaming by setting stream=True in the OpenAI client. The example uses the Requesty base URL and processes the response chunks, printing content as it arrives. ```python import openai client = openai.OpenAI( api_key="your_requesty_api_key", base_url="https://router.requesty.ai/v1", ) response = client.chat.completions.create( model="openai/gpt-5.6-sol", messages=[{"role": "user", "content": "Write a poem about the stars."}], stream=True ) # Process streaming response for chunk in response: if chunk.choices[0].delta.content is not None: content = chunk.choices[0].delta.content print(content, end="", flush=True) ``` -------------------------------- ### Basic Streaming Setup in JavaScript Source: https://docs.requesty.ai/features/streaming Enable streaming by setting stream: true in the OpenAI client. The example uses the Requesty base URL and iterates over the stream, writing content to stdout. ```javascript import OpenAI from 'openai'; const openai = new OpenAI({ apiKey: 'your_requesty_api_key', baseURL: 'https://router.requesty.ai/v1', }); const stream = await openai.chat.completions.create({ model: 'openai/gpt-5.6-sol', messages: [{ role: 'user', content: 'Write a poem about the stars.' }], stream: true, }); for await (const chunk of stream) { const content = chunk.choices[0]?.delta?.content; if (content) { process.stdout.write(content); } } ``` -------------------------------- ### Run OpenClaw onboarding wizard Source: https://docs.requesty.ai/integrations/openclaw Starts the OpenClaw onboarding wizard. Select Custom Provider and follow the prompts to configure Requesty. ```bash openclaw onboard ``` -------------------------------- ### Open OpenCode in any project Source: https://docs.requesty.ai/integrations/opencode Navigate to your project directory and launch OpenCode to begin the /connect setup. ```bash cd /path/to/project opencode ``` -------------------------------- ### GET /v1/models/all Source: https://docs.requesty.ai/api-reference/endpoint/models-all-list Documentation for the GET /v1/models/all endpoint, including authentication behavior and response example. ```APIDOC ## GET /v1/models/all ### Description Get all available models of every modality in a single list. Each entry is the same object the modality specific endpoint returns, identified by its `api` field. If authenticated with a Requesty API key, returns only the models approved for your organization. Otherwise, returns all public models. ### Method GET ### Endpoint https://router.requesty.ai/v1/models/all ### Authentication Optional. Send the API key as either `Authorization: Bearer YOUR_REQUESTY_API_KEY` or `X-Api-Key: YOUR_REQUESTY_API_KEY`; both headers behave identically. | Request | Status | Result | | ---------------------------------------- | ------ | ----------------------------------------------------------------------------------- | | No `Authorization` or `X-Api-Key` header | `200` | All publicly available models | | Valid API key | `200` | Only the models approved for your organization and allowed by the key's access list | | Invalid, expired or revoked API key | `403` | `Invalid authorization token` — the request is rejected, not treated as anonymous | ### Response #### Success Response (200) Returns a list of available models. Each model object includes fields such as `api`, `id`, `object`, `created`, `updated`, `owned_by`, pricing information, `max_output_tokens`, `context_window`, and various capability flags. #### Response Example ```json { "object": "list", "data": [ { "api": "chat", "id": "vertex/claude-sonnet-4-5", "object": "model", "created": 1747933971, "updated": 1747933971, "owned_by": "system", "input_price": 0.000003, "caching_price": 0.00000375, "cached_price": 3.e-7, "output_price": 0.000015, "pricing": [ { "prompt_tokens_threshold": 0, "input_price": 0.000003, "caching_price": 0.00000375, "caching_5m_price": 0.00000375, "caching_1h_price": 0.000006, "cached_price": 3.e-7, "output_price": 0.000015 }, { "prompt_tokens_threshold": 200000, "input_price": 0.000006, "caching_price": 0.0000075, "caching_5m_price": 0.0000075, "caching_1h_price": 0.000012, "cached_price": 6.e-7, "output_price": 0.0000225 } ], "max_output_tokens": 64000, "context_window": 200000, "supports_caching": true, "supports_vision": true, "supports_computer_use": true, "supports_reasoning": true, "supports_image_generation": false, "supports_tool_calling": true, "supports_role_developer": false, "supports_web_search": true, "supports_output_json_object": true, "supports_output_json_schema": true, "description": "The first hybrid reasoning model on the market with the highest level of intelligence and capability with toggleable extended thinking. Top-tier results in reasoning, coding, multilingual tasks, long-context handling, honesty, and image processing.", "data_retention": false, "data_retention_days": 0, "data_used_for_training": false, "privacy_comments": "N/A", "geolocation": "global", "open_weights": false, "model_lab": "vertex", "model_canonical_name": "tbd" }, { "api": "embedding", "id": "vertex/google/gemini-embedding-2-preview", "object": "model", "created": 1774621394, "updated": 1774621394, "owned_by": "system", "pricing": { "input_text": 2.e-7, "input_audio": 0.0000064 } } ] } ``` ``` -------------------------------- ### Run the /connect command Source: https://docs.requesty.ai/integrations/opencode Run /connect in OpenCode and select Requesty from the provider list to start the integration. ```txt /connect ``` -------------------------------- ### Install DeepSeek Harness with npx Source: https://docs.requesty.ai/integrations/deepseek-harness Run the web UI once to create the harness home directory. This command initializes the harness environment. ```bash npx @deepseek-ai/dsh web ``` -------------------------------- ### Framework Integration Examples Source: https://docs.requesty.ai/features/structured-outputs Code examples showing how to use structured outputs with LangChain, Instructor, Pydantic AI, LiteLLM, and DSPy frameworks, all pointing to Requesty's OpenAI-compatible endpoint. ```python from langchain_openai import ChatOpenAI from langchain_core.messages import SystemMessage, HumanMessage from pydantic import BaseModel class Answer(BaseModel): championships: int summary: str llm = ChatOpenAI( model="anthropic/claude-sonnet-4-5", api_key="YOUR_REQUESTY_API_KEY", base_url="https://router.requesty.ai/v1", ) # .with_structured_output() sends json_schema under the hood structured_llm = llm.with_structured_output(Answer) result = structured_llm.invoke([ SystemMessage(content="Answer questions about NBA players."), HumanMessage(content="How many championships has LeBron James won?"), ]) print(f"{result.championships} championships") ``` ```python import instructor from openai import OpenAI from pydantic import BaseModel client = instructor.from_openai(OpenAI()) class UserInfo(BaseModel): name: str age: int email: str user = client.chat.completions.create( model="anthropic/claude-sonnet-4-5", response_model=UserInfo, messages=[ {"role": "user", "content": "John is 30 years old. His email is john@example.com"}, ], ) print(f"{user.name}, {user.age}, {user.email}") ``` ```python from pydantic_ai import Agent, OpenAIProvider from pydantic import BaseModel class CityInfo(BaseModel): name: str country: str population: int known_for: list[str] provider = OpenAIProvider( api_key="YOUR_REQUESTY_API_KEY", base_url="https://router.requesty.ai/v1", ) agent = Agent( model="anthropic/claude-sonnet-4-5", system_prompt="Provide information about cities.", output_type=CityInfo, ) result = agent.run_sync("Tell me about Tokyo") print(f"{result.output.name}, {result.output.country}") print(f"Known for: {', '.join(result.output.known_for)}") ``` ```python import litellm import json response = litellm.completion( model="openai/anthropic/claude-sonnet-4-5", messages=[ {"role": "system", "content": "Extract the key entities."}, {"role": "user", "content": "Apple Inc. was founded by Steve Jobs in Cupertino."}, ], response_format={ "type": "json_schema", "json_schema": { "name": "Entities", "strict": True, "schema": { "type": "object", "properties": { "companies": {"type": "array", "items": {"type": "string"}}, "people": {"type": "array", "items": {"type": "string"}}, "locations": {"type": "array", "items": {"type": "string"}} }, "required": ["companies", "people", "locations"], "additionalProperties": False } } }, api_key="YOUR_REQUESTY_API_KEY", api_base="https://router.requesty.ai/v1", ) print(json.loads(response.choices[0].message.content)) ``` ```python import dspy class ExtractInfo(dspy.Signature): """Extract structured information from text.""" text: str = dspy.InputField() companies: list[str] = dspy.OutputField(desc="Company names mentioned") people: list[str] = dspy.OutputField(desc="People mentioned") locations: list[str] = dspy.OutputField(desc="Locations mentioned") lm = dspy.LM( model="openai/anthropic/claude-sonnet-4-5", api_key="YOUR_REQUESTY_API_KEY", api_base="https://router.requesty.ai/v1", ) with dspy.context(lm=lm): predict = dspy.Predict(ExtractInfo) result = predict(text="Sundar Pichai leads Google from their Mountain View office.") print(result.companies) # ["Google"] print(result.people) # ["Sundar Pichai"] ``` -------------------------------- ### OpenAPI Specification for GET /v1/models/all Source: https://docs.requesty.ai/api-reference/endpoint/models-all-list OpenAPI specification for the GET /v1/models/all endpoint, showing the request and response schema with example model data. ```yaml openapi: 3.0.3 info: title: Requesty Inference API description: >- Requesty Inference API for AI model routing. OpenAI-compatible endpoints for chat completions, embeddings, images, audio, and more. version: 1.0.0 servers: - url: https://router.requesty.ai description: Inference router endpoint security: - BearerAuth: [] paths: /v1/models/all: servers: - url: https://router.requesty.ai description: Inference router endpoint get: summary: List available models across all modalities description: >- Get all available models of every modality in a single list. Each entry is the same object the modality specific endpoint returns, identified by its `api` field. If authenticated with a Requesty API key, returns only the models approved for your organization. Otherwise, returns all public models. operationId: listAllModels responses: '200': description: List of available models content: application/json: schema: $ref: '#/components/schemas/AllModelsResponse' example: object: list data: - api: chat id: vertex/claude-sonnet-4-5 object: model created: 1747933971 updated: 1747933971 owned_by: system input_price: 0.000003 caching_price: 0.00000375 cached_price: 3.e-7 output_price: 0.000015 pricing: - prompt_tokens_threshold: 0 input_price: 0.000003 caching_price: 0.00000375 caching_5m_price: 0.00000375 caching_1h_price: 0.000006 cached_price: 3.e-7 output_price: 0.000015 - prompt_tokens_threshold: 200000 input_price: 0.000006 caching_price: 0.00000375 caching_5m_price: 0.00000375 caching_1h_price: 0.000006 cached_price: 6.e-7 output_price: 0.0000225 max_output_tokens: 64000 context_window: 200000 supports_caching: true supports_vision: true supports_computer_use: true supports_reasoning: true supports_image_generation: false supports_tool_calling: true supports_role_developer: false supports_web_search: true supports_output_json_object: true supports_output_json_schema: true description: >- The first hybrid reasoning model on the market with the highest level of intelligence and capability with toggleable extended thinking. Top-tier results in reasoning, coding, multilingual tasks, long-context handling, honesty, and image processing. data_retention: false data_retention_days: 0 data_used_for_training: false privacy_comments: N/A geolocation: global open_weights: false model_lab: vertex model_canonical_name: tbd - api: embedding id: vertex/google/gemini-embedding-2-preview object: model created: 1774621394 updated: 1774621394 owned_by: system pricing: input_text: 2.e-7 input_audio: 0.0000064 ``` -------------------------------- ### Model Configuration and Verification Prompt Source: https://docs.requesty.ai/integrations/opencode Configuration example for setting the default model in OpenCode, and a sample prompt to verify the integration. ```json { "model": "requesty/openai/gpt-5" } ``` ```txt > Summarize the README of this repo in 3 bullet points. ``` -------------------------------- ### cURL Request to Get Organization Usage Source: https://docs.requesty.ai/api-reference/endpoint/manage-org-get-usage Sends a GET request to /v1/manage/org/usage with start, end, resolution, and group_by parameters. Requires a Bearer token for authentication. ```bash curl -X GET "https://api-v2.requesty.ai/v1/manage/org/usage?start=2025-01-01T00:00:00Z&end=2025-01-31T23:59:59Z&resolution=day&group_by=model_used" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Example 200 response for /v1/models/chat Source: https://docs.requesty.ai/api-reference/endpoint/models-chat-list Example 200 response from the /v1/models/chat endpoint. Shows a model object with pricing tiers, capability flags, and metadata. The response is identical to GET /v1/models. ```json { "object": "list", "data": [ { "api": "chat", "id": "vertex/claude-sonnet-4-5", "object": "model", "created": 1747933971, "updated": 1747933971, "owned_by": "system", "pricing": [ { "prompt_tokens_threshold": 0, "input_price": 3e-06, "caching_price": 3.75e-06, "caching_5m_price": 3.75e-06, "caching_1h_price": 6e-06, "cached_price": 3e-07, "output_price": 1.5e-05 }, { "prompt_tokens_threshold": 200000, "input_price": 6e-06, "caching_price": 7.5e-06, "caching_5m_price": 7.5e-06, "caching_1h_price": 1.2e-05, "cached_price": 6e-07, "output_price": 2.25e-05 } ], "max_output_tokens": 64000, "context_window": 200000, "supports_caching": true, "supports_vision": true, "supports_computer_use": true, "supports_reasoning": true, "supports_image_generation": false, "supports_tool_calling": true, "supports_role_developer": false, "supports_web_search": true, "supports_output_json_object": true, "supports_output_json_schema": true, "description": "The first hybrid reasoning model on the market with the highest level of intelligence and capability with toggleable extended thinking. Top-tier results in reasoning, coding, multilingual tasks, long-context handling, honesty, and image processing.", "data_retention": false, "data_retention_days": 0, "data_used_for_training": false, "privacy_comments": "N/A", "geolocation": "global", "open_weights": false, "model_lab": "vertex", "model_canonical_name": "claude-sonnet-4-5" } ] } ``` -------------------------------- ### Use descriptions for guidance Source: https://docs.requesty.ai/features/structured-outputs Example of adding a description field to a schema property to guide the model. ```json { "type": "object", "properties": { "confidence": { "type": "number", "description": "A confidence score between 0.0 and 1.0" } } } ``` -------------------------------- ### Instructions Parameter Source: https://docs.requesty.ai/api-reference/endpoint/responses-create Example of using the instructions parameter to set a system-level prompt. ```json { "model": "openai-responses/gpt-5", "instructions": "You are a helpful assistant that always responds in JSON.", "input": "Summarize the weather in Paris today." } ``` -------------------------------- ### OpenAPI Specification for GET /v1/manage/org/usage Source: https://docs.requesty.ai/api-reference/endpoint/manage-org-get-usage Defines the GET /v1/manage/org/usage endpoint with parameters start, end, resolution, and group_by. The date range cannot exceed 100 days. The response schema references GetOrgUsageResponse and ErrorResponse. ```yaml openapi: 3.0.3 info: title: Requesty API description: Requesty API for AI model routing and key management version: 1.0.0 servers: - url: https://api-v2.requesty.ai description: Management API endpoint - url: https://router.requesty.ai description: Inference router endpoint security: - BearerAuth: [] paths: /v1/manage/org/usage: servers: - url: https://api-v2.requesty.ai description: Management API endpoint get: summary: Get organization usage description: >- Get aggregated usage statistics for your entire organization within a date range. Supports aggregation by different time periods and optional grouping by user, model, or custom fields. operationId: getOrgUsage parameters: - name: start in: query required: true schema: type: string format: date-time example: '2025-01-01T00:00:00Z' description: >- Start date in RFC3339 format (e.g., 2025-01-01T00:00:00Z). Required. The date range cannot exceed 100 days from start to end. - name: end in: query required: false schema: type: string format: date-time example: '2025-01-31T23:59:59Z' description: >- End date in RFC3339 format (e.g., 2025-01-31T23:59:59Z). Optional. Defaults to 24 hours from start if not specified. Must be after start date. The date range cannot exceed 100 days. - name: resolution in: query required: false schema: type: string enum: - hour - day - month default: day description: Time resolution for aggregation - name: group_by in: query required: false schema: type: array items: type: string description: >- Fields to group by: group_name, group_id, member_id, member_email, user_id, api_key_id, model_requested, model_used, provider_used, is_byok, origin_title, extra., api_key_label., or group_label.. Rows missing a requested label are grouped under "Unknown". Can be specified multiple times. responses: '200': description: Successfully retrieved usage data content: application/json: schema: $ref: '#/components/schemas/GetOrgUsageResponse' '400': description: Bad request - malformed payload or invalid parameters. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized - missing or empty Authorization header. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '402': description: Payment required - organization balance exhausted. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden - invalid token or model not in access list. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found - provider/model not supported. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '429': description: Too many requests - rate limit exceeded. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - BearerAuth: [] components: securitySchemes: BearerAuth: type: http scheme: bearer schemas: GetOrgUsageResponse: type: object properties: data: type: array items: $ref: '#/components/schemas/UsageRecord' meta: type: object properties: start: type: string format: date-time end: type: string format: date-time resolution: type: string enum: [hour, day, month] group_by: type: array items: type: string UsageRecord: type: object properties: start: type: string format: date-time end: type: string format: date-time group_name: type: string group_id: type: string member_id: type: string member_email: type: string user_id: type: string api_key_id: type: string model_requested: type: string model_used: type: string provider_used: type: string is_byok: type: boolean origin_title: type: string extra: type: object additionalProperties: type: string api_key_labels: type: object additionalProperties: type: string group_labels: type: object additionalProperties: type: string total_requests: type: integer total_prompt_tokens: type: integer total_completion_tokens: type: integer total_tokens: type: integer total_cost_usd: type: number total_latency_ms: type: number ErrorResponse: type: object properties: error: type: object properties: code: type: string message: type: string details: type: object additionalProperties: true ``` -------------------------------- ### Install Requesty OpenCode wrapper Source: https://docs.requesty.ai/integrations/opencode Command to install the Requesty OpenCode wrapper. ```bash curl -fsSL https://www.requesty.ai/opencode/install.sh | bash ``` -------------------------------- ### OpenAPI Specification for GET /v1/models/chat Source: https://docs.requesty.ai/api-reference/endpoint/models-chat-list YAML OpenAPI 3.0.3 specification for the GET /v1/models/chat endpoint. It defines the server URL, security scheme, and response schemas including a detailed example model object with pricing tiers and capabilities. ```yaml openapi: 3.0.3 info: title: Requesty Inference API description: >- Requesty Inference API for AI model routing. OpenAI-compatible endpoints for chat completions, embeddings, images, audio, and more. version: 1.0.0 servers: - url: https://router.requesty.ai description: Inference router endpoint security: - BearerAuth: [] paths: /v1/models/chat: servers: - url: https://router.requesty.ai description: Inference router endpoint get: summary: List available chat models description: >- Get all available chat models. Identical to `GET /v1/models`, including your aliases and routing policies. If authenticated with a Requesty API key, returns only the models approved for your organization. Otherwise, returns all public models. operationId: listChatModels responses: '200': description: List of available models content: application/json: schema: $ref: '#/components/schemas/ModelsResponse' example: object: list data: - api: chat id: vertex/claude-sonnet-4-5 object: model created: 1747933971 updated: 1747933971 owned_by: system input_price: 0.000003 caching_price: 0.00000375 cached_price: 3.e-7 output_price: 0.000015 pricing: - prompt_tokens_threshold: 0 input_price: 0.000003 caching_price: 0.00000375 caching_5m_price: 0.00000375 caching_1h_price: 0.000006 cached_price: 3.e-7 output_price: 0.000015 - prompt_tokens_threshold: 200000 input_price: 0.000006 caching_price: 0.0000075 caching_5m_price: 0.0000075 caching_1h_price: 0.000012 cached_price: 6.e-7 output_price: 0.0000225 max_output_tokens: 64000 context_window: 200000 supports_caching: true supports_vision: true supports_computer_use: true supports_reasoning: true supports_image_generation: false supports_tool_calling: true supports_role_developer: false supports_web_search: true supports_output_json_object: true supports_output_json_schema: true description: >- The first hybrid reasoning model on the market with the highest level of intelligence and capability with toggleable extended thinking. Top-tier results in reasoning, coding, multilingual tasks, long-context handling, honesty, and image processing. data_retention: false data_retention_days: 0 data_used_for_training: false privacy_comments: N/A geolocation: global open_weights: false model_lab: vertex model_canonical_name: tbd '400': description: Bad request - malformed payload or invalid parameters. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized - missing or empty Authorization header. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '402': ``` -------------------------------- ### Example Request Source: https://docs.requesty.ai/api-reference/endpoint/audio-speech-create Example curl command to synthesize speech and save the audio to a file. ```bash curl https://router.requesty.ai/v1/audio/speech \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \ --output speech.mp3 \ -d '{ "model": "openai/gpt-4o-mini-tts", "input": "The quick brown fox jumped over the lazy dog.", "voice": "alloy", "response_format": "mp3" }' ``` -------------------------------- ### Haystack Integration with Structured Outputs Source: https://docs.requesty.ai/features/structured-outputs Example of using Haystack's OpenAIChatGenerator with Requesty to get structured JSON output. ```python from haystack.components.generators.chat import OpenAIChatGenerator from haystack.utils import Secret from haystack.dataclasses import ChatMessage import json generator = OpenAIChatGenerator( model="vertex/gemini-2.5-flash", api_key=Secret.from_token("YOUR_REQUESTY_API_KEY"), api_base_url="https://router.requesty.ai/v1", generation_kwargs={ "response_format": { "type": "json_schema", "json_schema": { "name": "Analysis", "strict": True, "schema": { "type": "object", "properties": { "topic": {"type": "string"}, "sentiment": {"type": "string"}, "confidence": {"type": "number"} }, "required": ["topic", "sentiment", "confidence"], "additionalProperties": False } } } }, ) generator.warm_up() result = generator.run(messages=[ ChatMessage.from_system("Analyze the topic and sentiment of the text."), ChatMessage.from_user("I absolutely love the new Python 3.13 release!"), ]) analysis = json.loads(result["replies"][0].text) print(f"Topic: {analysis['topic']}, Sentiment: {analysis['sentiment']}") ``` -------------------------------- ### Example Response for Get Organization Usage Source: https://docs.requesty.ai/api-reference/endpoint/manage-org-get-usage Shows a successful response with usage records grouped by model_used. Each record includes token counts, cost, and latency. ```json { "data": [ { "start": "2025-01-01T00:00:00Z", "end": "2025-01-01T23:59:59Z", "model_used": "gpt-4o", "total_requests": 120, "total_prompt_tokens": 15000, "total_completion_tokens": 3000, "total_tokens": 18000, "total_cost_usd": 0.45, "total_latency_ms": 850 }, { "start": "2025-01-01T00:00:00Z", "end": "2025-01-01T23:59:59Z", "model_used": "claude-3-5-sonnet", "total_requests": 80, "total_prompt_tokens": 10000, "total_completion_tokens": 2000, "total_tokens": 12000, "total_cost_usd": 0.30, "total_latency_ms": 720 } ], "meta": { "start": "2025-01-01T00:00:00Z", "end": "2025-01-31T23:59:59Z", "resolution": "day", "group_by": ["model_used"] } } ```