Skip to content

About

GPT-6.2 API examples in cURL, Node.js, and Python for GPT-6.2 Astra and GPT-6.2 Sol through PoYo (Chat Completions and Responses). From $1.6 per 1M input tokens.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

GPT-6.2 API: cURL, Python, and Node.js Examples

GPT-6.2 Astra on PoYo GPT-6.2 Sol on PoYo API docs Check

Runnable examples for OpenAI GPT-6.2 Astra and GPT-6.2 Sol through PoYo's OpenAI-compatible Chat Completions and Responses endpoints: plain requests, reasoning effort, streaming, and the official OpenAI SDKs with a changed base URL.

Answer: To use the GPT-6.2 API, send a server-side request to POST https://api.poyo.ai/v1/chat/completions or POST https://api.poyo.ai/v1/responses with "model": "gpt-6.2-astra" or "model": "gpt-6.2-sol" and a PoYo API key. With the OpenAI SDK, set the base URL to https://api.poyo.ai/v1. The examples in this repository run with Python 3.9+, Node.js 22+, or cURL.

Last verified against the PoYo API reference and pricing on November 18, 2026.

GPT-6.2 at a glance

  • Model IDs: gpt-6.2-astra (frontier tier) and gpt-6.2-sol (efficient tier)
  • Released: November 17, 2026 by OpenAI
  • Endpoints: Chat Completions (/v1/chat/completions) and Responses (/v1/responses), both with streaming
  • Context: 1,050,000 tokens, up to 128,000 output tokens per response
  • Input: text and images; output is text
  • Reasoning effort: low, medium (default), high, xhigh, max, set with reasoning.effort in Responses
  • Price on PoYo: Astra $6.40 input / $32.00 output, Sol $1.60 input / $8.00 output per 1M tokens, 20% below OpenAI's standard rates

Quickstart

  1. Create a key in the PoYo dashboard.
  2. Copy .env.example to .env and replace the placeholder.
  3. Run one of the examples. Each prints the model's text and the token usage.
POYO_API_KEY=YOUR_POYO_API_KEY_HERE
POYO_BASE_URL=https://api.poyo.ai

Python

python python/generate.py                                  # Chat Completions, gpt-6.2-sol
python python/generate.py payloads/responses.json          # Responses, gpt-6.2-astra, high effort
python python/generate.py payloads/responses-stream.json   # Responses streaming
python python/generate.py payloads/chat-completions.json gpt-6.2-astra   # same request, other model

python/generate.py uses only the Python standard library. Payloads with messages go to Chat Completions and payloads with input go to Responses.

Node.js

node node/index.mjs
node node/index.mjs payloads/chat-completions-stream.json
node node/index.mjs payloads/responses.json gpt-6.2-sol

node/index.mjs has no dependencies.

cURL

curl -X POST "https://api.poyo.ai/v1/chat/completions" \
  -H "Authorization: Bearer $POYO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6.2-sol", "messages": [{"role": "user", "content": "Explain the CAP theorem in three sentences."}]}'

Responses, reasoning effort, and streaming requests are in curl/generate.md.

OpenAI SDK

Existing OpenAI clients only need a new API key and base URL.

import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["POYO_API_KEY"], base_url="https://api.poyo.ai/v1")
response = client.responses.create(
    model="gpt-6.2-sol",
    input="When should a web service return HTTP 409 instead of 400?",
    reasoning={"effort": "low"},
)
print(response.output_text)
import OpenAI from "openai";

const client = new OpenAI({ apiKey: process.env.POYO_API_KEY, baseURL: "https://api.poyo.ai/v1" });
const completion = await client.chat.completions.create({
  model: "gpt-6.2-astra",
  messages: [{ role: "user", content: "Write a one-line commit message for: fix off-by-one error in pagination." }],
});
console.log(completion.choices[0].message.content);

Runnable versions with Chat Completions, Responses, and streaming: python/openai_sdk.py (pip install openai) and node/openai-sdk.mjs (cd node && npm install).

Example requests

File Endpoint Model Task
chat-completions.json Chat Completions gpt-6.2-sol Find and fix a pagination bug
chat-completions-stream.json Chat Completions, streaming gpt-6.2-sol Three-line release note
responses.json Responses gpt-6.2-astra Zero-downtime UUID migration plan, reasoning.effort: high
responses-stream.json Responses, streaming gpt-6.2-sol Optimistic vs pessimistic locking, reasoning.effort: low

Pass a model ID as the second argument to the Python or Node.js example to run any payload on the other model.

Request fields

Chat Completions

Field Requirement Meaning
model required gpt-6.2-astra or gpt-6.2-sol.
messages required system, user, and assistant messages with content.
max_tokens optional Maximum generated tokens.
temperature optional 0–2.
top_p optional 0–1. Use either top_p or temperature.
stream optional true returns server-sent events.

Responses

Field Requirement Meaning
model required gpt-6.2-astra or gpt-6.2-sol.
input required A string, or role / content items with input_text and input_image blocks.
instructions optional System or developer instructions.
reasoning optional {"effort": "low"} through {"effort": "max"}.
max_output_tokens optional Maximum output tokens.
stream optional true returns server-sent events.
store optional Whether to store the response.
previous_response_id optional Continue a conversation from an earlier response.

Both endpoints return OpenAI's native response shape, without the code / data wrapper used by PoYo generation tasks. Chat Completions text is in choices[0].message.content. Responses text is in the output_text blocks of output[] items with type: "message", and the OpenAI SDKs expose it as output_text.

Pricing

Billing is per token. 1 credit = $0.005.

Model Input Output Cache read Cache write
gpt-6.2-astra 1,280 credits ($6.40) 6,400 credits ($32.00) 64 credits ($0.32) 1,600 credits ($8.00)
OpenAI standard rate $8.00 $40.00 $0.40 $10.00
gpt-6.2-sol 320 credits ($1.60) 1,600 credits ($8.00) 16 credits ($0.08) 400 credits ($2.00)
OpenAI standard rate $2.00 $10.00 $0.10 $2.50

All prices are per 1M tokens. Example: a request with 10,000 input tokens and 2,000 output tokens costs $0.032 (6.4 credits) on Sol and $0.128 (25.6 credits) on Astra. Reasoning tokens are part of output_tokens and bill as output. Confirm current prices on the GPT-6.2 Astra and GPT-6.2 Sol model pages.

Sol or Astra?

GPT-6.2 Sol GPT-6.2 Astra
OpenAI positioning Go-to model for everyday work: coding, clear writing, multistep agents Frontier model for the hardest projects: professional documents, science, complex coding
PoYo price per 1M tokens $1.60 input / $8.00 output $6.40 input / $32.00 output
Context and output 1,050,000 / 128,000 tokens 1,050,000 / 128,000 tokens
Start here for High-volume coding, agent steps, chat, drafting Final deliverables, research analysis, large refactors
  • Default to Sol. It costs a quarter of Astra per token.
  • Escalate to Astra for slides, spreadsheets, and memos that must follow your templates and your field's conventions, for scientific analysis run step by step, and for complex changes in large codebases, where a failed run costs more than the token difference.
  • Raise effort before switching models. Try Sol at high or xhigh before moving a task to Astra, and keep medium as the starting point for new integrations.
  • Route in code. Both models take the same request on the same endpoints, so routing is a change to model: pick by task type, or run Sol first and retry on Astra when a check fails (tests, schema validation, a reviewer step).

Streaming

  • Chat Completions: each data: line is a chat.completion.chunk. Text arrives in choices[0].delta.content, a chunk near the end carries usage, and the stream ends with data: [DONE].
  • Responses: each data: line is an event whose type names it. Concatenate response.output_text.delta events; response.completed carries the final response and usage. Ignore event types you do not handle.

Treat a stream that closes before data: [DONE] (or, for Responses, before response.completed) as failed and retry it. The examples in this repository exit with an error in that case.

Production guidance

Set an application timeout long enough for high reasoning effort, retry only 429 and transient 5xx responses, and record usage from every response, including input_tokens_details.cached_tokens and output_tokens_details.reasoning_tokens. Do not put POYO_API_KEY in browser or mobile client code. Check the HTTP status and the error object rather than a code field. More in docs/production-notes.md.

FAQ

How much does the GPT-6.2 API cost? On PoYo, GPT-6.2 Astra costs $6.40 per 1M input tokens and $32.00 per 1M output tokens; GPT-6.2 Sol costs $1.60 and $8.00. Both are 20% below OpenAI's standard rates. Cache reads cost $0.32 (Astra) and $0.08 (Sol) per 1M tokens.

What is the difference between GPT-6.2 Astra and GPT-6.2 Sol? Astra is OpenAI's frontier GPT-6.2 model for the hardest professional, scientific, and coding work. Sol is the efficient model for everyday coding, writing, and agents at a quarter of Astra's token price. Both share the 1,050,000-token context window and 128,000-token output limit.

Can I use the OpenAI SDK? Yes. Set the base URL to https://api.poyo.ai/v1, use your PoYo API key, and set model to gpt-6.2-astra or gpt-6.2-sol.

Should I use Chat Completions or Responses? Both work with both models. Use Chat Completions to drop GPT-6.2 into existing chat code. Use Responses for reasoning.effort, instructions, previous_response_id, and structured image input.

Does it support streaming? Yes. Set "stream": true on either endpoint.

What are the context window and max output? 1,050,000 tokens of context and up to 128,000 output tokens per response, for both models.

Repository map

Related repositories

Links

License

MIT

About

GPT-6.2 API examples in cURL, Node.js, and Python for GPT-6.2 Astra and GPT-6.2 Sol through PoYo (Chat Completions and Responses). From $1.6 per 1M input tokens.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages