Available for Pay Users
After buying Codex Pay, copy the Pay proxy token from the dashboard and use it as the OpenAI SDK API key. Model requests are recorded as Pay usage and deducted from balance.
PhotonMark Codex
After buying Codex Pay, copy the Pay proxy token from the dashboard and use it as the OpenAI SDK API key. Model requests are recorded as Pay usage and deducted from balance.
Currently planned only for Codex Pay. Link and Boost involve the user's own ChatGPT authorization and are not suitable as generic model API forwarding endpoints.
The test form uses https://codex.photonmark.com/openai/v1 as the base URL, with the Pay proxy token in Authorization: Bearer .
For OpenAI-compatible clients, use only https://codex.photonmark.com/openai/v1 as the base URL. Do not use the dedicated proxy URL from the dashboard Codex TOML config, because some clients will append the wrong path and fail to connect.
| Endpoint | Status | Notes |
|---|---|---|
POST /openai/v1/chat/completions |
Active | For Chat Completions calls compatible with common OpenAI SDK usage. Normal JSON responses and experimental streaming text responses are supported; agent clients such as Codex and Claude that use tool calls should prefer the Responses API. |
POST /openai/v1/responses |
Active | For a call shape closer to the Responses API. The server currently performs the compatibility conversion needed for Codex upstream. |
POST /openai/v1/images/generations |
Active | Generates images from text prompts with gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst, gpt-image-2.6-flare, gpt-image-2.6-sunburst, or gpt-image-1.5 (see image models). Standard OpenAI Python / Node.js SDKs and Bearer tokens are supported, and the response contains base64 image data. |
POST /openai/v1/images/edits |
Active | Edits images with the same image models. Standard OpenAI SDK multipart uploads are supported, with one or more reference images and an optional mask. |
POST /openai/v1/audio/transcriptions |
Available | Speech-to-text for an uploaded audio file, compatible with the OpenAI SDK transcription call. Billed per second of audio; see audio transcription. |
GET /openai/v1/models |
Active | Lists the current text and Codex model catalog. It is not an exhaustive list of image tool models, so the absence of gpt-image-2 does not mean that the Image API is unavailable. |
GET /api/v1/usage/charges |
Available | Read-only historical usage export with a separate Dashboard-created key. Supports timezone-aware from/to, cursor pagination, exact filters, JSON, and CSV; the key cannot call models or spend balance. |
Open Dashboard → Usage & billing to create the account's one active read-only Usage API key. Complete key values and copy-ready commands are shown once and stored only as a hash. Up to 10,000 rows can be returned per page, with next_cursor for continuation. JSON and CSV requests share a per-key limit of 3 requests per 60 seconds.
curl -sS -H "Authorization: Bearer <USAGE_API_KEY>" \
"https://codex.photonmark.com/api/v1/usage/charges.csv?from=2026-08-01T00%3A00%3A00Z&to=2026-08-02T00%3A00%3A00Z&limit=10000" \
-o photonmark-usage.csv
For per-agent cost and cache analysis, attach strings under metadata.photonmark_agent, metadata.photonmark_agent_version, and metadata.photonmark_session_id. The pm_* aliases are also accepted. These opt-in labels appear in the Dashboard CSV and Usage API alongside input, uncached input, cached input, cache-write, output, cost, latency, and status fields. Dashboard provides a complete copy-ready model request with the active Pay API key filled in.
Use opaque labels without prompts, personal information, credentials, or other secrets. The labels remain with the billing record.
POST /openai/v1/audio/transcriptions converts recorded speech to text with Google Gemini. It accepts the same multipart request as OpenAI's transcription API, so an existing SDK call only needs the PhotonMark base URL and Pay API key. It works with Spanish, Portuguese (including Brazilian Portuguese), English, Chinese and other widely spoken languages, and keeps the spoken language rather than translating.
| Field | Supported values and behavior |
|---|---|
file |
Required. MP3, WAV, FLAC, M4A/MP4, OGG (Opus or Vorbis) or WebM, up to 25 MB and 60 minutes per request. The format is detected from the file content. For a full hour, use MP3 or M4A at 48 kbps or less so the file stays under 25 MB; split longer recordings into several files. |
model |
gemini-transcribe. whisper-1, gpt-4o-transcribe, gpt-4o-mini-transcribe and gpt-transcribe are accepted as aliases for the same service, so the price does not change with the name. |
language |
Optional ISO-639 code such as es, pt or pt-BR. It is a hint; the transcript stays in the spoken language. |
prompt |
Optional, up to 1000 bytes: names and terms to spell correctly. It is checked by the safety filter before the request. |
response_format |
json (default), text or verbose_json. verbose_json adds the audio length but no segments. srt and vtt are not supported. |
temperature |
Optional, 0 to 1. |
Processing time: a few minutes of audio takes about 20 seconds, but a recording of 20 minutes or more usually takes 3 to 5 minutes (a 24-minute Chinese recording took about 3.5 minutes) and can take up to about 9, so use a client timeout of 10 minutes (the OpenAI SDK default). Wait for the result rather than cancelling and sending the file again: a resent file starts from the beginning. While a long request is working, PhotonMark sends newline characters to keep the connection open, so curl first prints blank lines and the response can begin with them; this is not an error, and JSON parsers ignore them. If the request then fails, the HTTP status is already 200 and the failure is reported in the body as error with "status": 503; check for it before reading text, and retry later. Failed requests are not charged.
Billing: USD $0.006 per minute of audio from the Pay balance, settled to the second. See the pricing page. JSON responses include usage.seconds, the billed length. The transcript has no timestamps, word timings or speaker labels, and /audio/translations is not available.
Safety and privacy: PhotonMark does not store the audio or the transcript text. Each transcript is checked by the automated safety filter after transcription; sexual content involving minors is withheld (HTTP 403, not charged), and other content is returned unchanged.
No separate activation is required. Every active Pay proxy token can call both image endpoints and uses the same Pay balance as text requests. There is no separate image permission application or image-only top-up.
Copy-ready examples: curl: image generation, Python SDK: image generation, Python SDK: image editing with reference images.
Set model to any model in the table below; each works for both generation and editing. The code examples use gpt-image-2. See the pricing page for token rates and deductions.
| Model | Notes | Billing |
|---|---|---|
gpt-image-2 | Recommended default; all examples on this page use it. | gpt-image-2 token rates. |
gpt-image-2.5-flare | GPT Image 2.5, speed-first variant (released by OpenAI on 2026-09-08). | OpenAI's official GPT Image 2.5 prices; see the pricing page. |
gpt-image-2.5-sunburst | GPT Image 2.5, quality-first variant; better at multi-turn edits and preserving reference subjects. | OpenAI's official GPT Image 2.5 prices; see the pricing page. |
gpt-image-2.6-flare | GPT Image 2.6, fast-iteration variant; OpenAI official API only, currently for selected accounts. | Real tokens reported by OpenAI at the official GPT Image 2.6 rates; see pricing. |
gpt-image-2.6-sunburst | GPT Image 2.6, for detailed visual work; OpenAI official API only, currently for selected accounts. | Real tokens reported by OpenAI at the official GPT Image 2.6 rates; see pricing. |
gpt-image-1.5 | Previous-generation image model. | gpt-image-1.5 token rates. |
Model names not listed above, including gpt-image-1, gpt-image-1-mini, and gpt-image-2.5 without a suffix, are not currently supported, and such a request may not use the model you named.
The table below describes the parameters currently passed through by PhotonMark. For predictable billing, specify quality and size explicitly.
| Parameter | Supported values and behavior |
|---|---|
quality |
low, medium, high, or auto. GPT Image 2.5 and 2.6 (-flare, -sunburst) also accept xhigh and max; GPT Image 2.6 also takes complexity (low, medium, high; default high, no extra fee). auto is accepted, but explicit values make cost easier to predict. |
size |
Standard sizes are 1024x1024, 1536x1024, and 1024x1536. Custom sizes are accepted when each edge is a multiple of 16, the longest edge is at most 3840, the aspect ratio is at most 3:1, and total pixels are between 655,360 and 8,294,400. 3840x2160 and 2160x3840 are valid 4K requests, but output above 2560x1440 is experimental; inspect the dimensions of the returned file instead of assuming the request guarantees an exact final size. |
n |
From 1 to 10 images per request. Billing counts the images actually returned, so a larger n costs more only when more images come back. |
Reference images and mask |
Edits accept up to 16 reference images. An optional mask applies only to the first image and should match that image's size and format; transparent mask areas mark the region to edit. PhotonMark currently applies a 20 MiB overall upload guard. gpt-image-2 always uses high input fidelity and ignores input_fidelity. |
| Output | Image bytes are returned in data[].b64_json, not as a hosted URL. PNG is the default; JPEG and WebP are supported, with output_compression from 0 to 100 for JPEG/WebP. Transparent backgrounds are not supported by gpt-image-2. |
Quality, size and n are not guaranteed on the current image route. The upstream chooses the final image from your prompt. In our tests, a request for high at 1024x1024 came back as low at 1254x1254, and n=2 returned one image. To get a shape you want, state the orientation or aspect ratio in the prompt, then check the size of the returned file. Output is charged by the quality and size of the image actually returned.
Concurrency and timeouts: By default only one image request can run at a time and another sent meanwhile gets HTTP 429, so send them one after another. Retry transient HTTP 429/5xx responses with exponential backoff and jitter. Complex image requests can take up to about two minutes; use a client timeout of at least 180 seconds, while allowing for earlier CDN or network interruptions.
See the image prices and Pay deductions and the official OpenAI image-generation guide.
Any app that allows a custom OpenAI-compatible base_url and API key may be able to connect to this interface. For high concurrency, team sharing, or important production paths, contact us first to confirm rate limits, models, and expected usage.
Python / Node.js OpenAI SDKs, curl, internal automation scripts, background jobs, and data-processing workflows.
Agent or workflow platforms such as LangChain, LlamaIndex, Dify, and n8n that can configure an OpenAI endpoint.
Frontends such as LibreChat, Open WebUI, custom support chat, or knowledge-base pages that support custom OpenAI APIs.
Continue, editor plugins, or other tools that allow OpenAI-compatible providers.
When OpenCode uses the Responses API, the provider's npm should be @ai-sdk/openai. baseURL should use PhotonMark's standard API endpoint, and apiKey should use your Pay proxy token.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"photonmark": {
"npm": "@ai-sdk/openai",
"name": "PhotonMark",
"options": {
"baseURL": "https://codex.photonmark.com/openai/v1",
"apiKey": "{env:PHOTONMARK_PAY_TOKEN}"
},
"models": {
"gpt-6-sol": {
"name": "gpt-6-sol",
"limit": {
"context": 262144,
"output": 32768
}
}
}
}
}
}
strip-max-tokens.ts was previously used to remove max_output_tokens; it is no longer needed. Users who installed it can remove it and restart OpenCode; leaving it in place temporarily will not affect usage.
Compatibility boundary: PhotonMark accepts max_output_tokens sent by OpenCode / AI SDK and removes it before forwarding to Codex upstream. Therefore, this parameter is not enforced as a hard upstream output limit; actual output is determined by the model and upstream service.
For more provider field details, see the official OpenCode provider documentation.
When using tool calls in OpenCodex, select the openai-responses adapter; do not use the openai-chat adapter. The latter sends tool definitions in the Chat Completions shape, which may be incompatible with the Responses API.
{
"providers": {
"PhotonMark": {
"adapter": "openai-responses",
"baseUrl": "https://codex.photonmark.com/openai/v1",
"authMode": "key",
"apiKey": "${PHOTONMARK_PAY_TOKEN}",
"defaultModel": "gpt-5.6-sol"
}
}
}
If PhotonMark is already configured as a provider, change only openai-chat to openai-responses, keep the existing Pay API Key, model, and other routing fields; then run ocx restart and start a new session.
Troubleshooting:If you see Missing required parameter: 'tools[0].name', the request is usually still being sent by the openai-chat adapter. Switching to openai-responses requires no PhotonMark server-side changes.
For more adapter field details, see the official OpenCodex adapter documentation.
After buying Codex Pay, copy your Pay proxy token from the dashboard. Examples put the token in PHOTONMARK_PAY_TOKEN environment variable to avoid putting it in code.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PHOTONMARK_PAY_TOKEN"],
base_url="https://codex.photonmark.com/openai/v1",
)
resp = client.chat.completions.create(
model="gpt-6-luna",
messages=[{"role": "user", "content": "Reply with OK only."}],
)
print(resp.choices[0].message.content)
This uses your PhotonMark Pay proxy token and does not require an official OpenAI Platform API key. Images are charged to the Pay balance: input by tokens, output by the quality and resolution of the returned image; see thepricing page.
import base64
import os
from pathlib import Path
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PHOTONMARK_PAY_TOKEN"],
base_url="https://codex.photonmark.com/openai/v1",
)
resp = client.images.generate(
model="gpt-image-2",
prompt="Draw a simple cute cat.",
quality="low",
size="1024x1024",
)
image_base64 = resp.data[0].b64_json
if not image_base64:
raise RuntimeError("Image API returned no image data")
output = Path("photonmark-cat.png")
output.write_bytes(base64.b64decode(image_base64))
print(f"Saved to: {output.resolve()}")
Put the main image first, followed by optional style or palette references. Up to 16 reference images are currently supported. The optional mask applies only to the first image.gpt-image-2 uses high input fidelity by default, so you do not need to set input_fidelity.
from pathlib import Path
with open("main.png", "rb") as main_image, open("style.png", "rb") as style_image:
resp = client.images.edit(
model="gpt-image-2",
image=[main_image, style_image],
prompt="Keep the main object's geometry and apply the reference palette.",
quality="high",
size="1536x1024",
)
image_base64 = resp.data[0].b64_json
if not image_base64:
raise RuntimeError("Image Edit API returned no image data")
output = Path("photonmark-edited.png")
output.write_bytes(base64.b64decode(image_base64))
print(f"Saved to: {output.resolve()}")
export PHOTONMARK_PAY_TOKEN='your PhotonMark Pay API Key'
curl https://codex.photonmark.com/openai/v1/chat/completions \
-H "Authorization: Bearer $PHOTONMARK_PAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-luna",
"messages": [
{"role": "user", "content": "Reply with OK only."}
]
}'
export PHOTONMARK_PAY_TOKEN='your PhotonMark Pay API Key'
curl https://codex.photonmark.com/openai/v1/images/generations \
-H "Authorization: Bearer $PHOTONMARK_PAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Draw a simple cute cat.",
"quality": "low",
"size": "1024x1024"
}' | jq -r '.data[0].b64_json' | base64 --decode > photonmark-cat.png
language is only a hint: the transcript stays in the spoken language, and a recording that mixes languages is better left on auto-detect.
curl https://codex.photonmark.com/openai/v1/audio/transcriptions \
-H "Authorization: Bearer $PHOTONMARK_PAY_TOKEN" \
--max-time 600 \
-F model=gemini-transcribe \
-F language=en \
-F [email protected]
The file name does not affect recognition or billing: the format is detected from the file content, so a wrong extension (an M4A file named .mp3) is fine. In curl, the shell and curl itself read the name, so quote it as below. In Python, pass the path as an ordinary string; no escaping is needed.
# Spaces, brackets or non-English letters: wrap the whole field in double quotes
-F "file=@Team meeting (1).m4a"
# A semicolon ; or comma , in the name: single quotes outside, double quotes around the name
-F 'file=@"Interview;part 2,final.m4a"'
# Send it under a simpler name with filename=
-F 'file=@"Interview;part 2,final.m4a";filename=meeting.m4a'
# Save the transcript straight to a text file
-F response_format=text -o meeting.txt
On Windows PowerShell, type curl.exe rather than curl (in Windows PowerShell 5, curl is another command), and either write the command on one line or end lines with a backtick ` instead of \: curl.exe https://codex.photonmark.com/openai/v1/audio/transcriptions -H "Authorization: Bearer $env:PHOTONMARK_PAY_TOKEN" --max-time 600 -F model=gemini-transcribe -F "file=@C:\Users\me\Downloads\Team meeting (1).m4a"
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PHOTONMARK_PAY_TOKEN"],
base_url="https://codex.photonmark.com/openai/v1",
timeout=600, # a 60-minute recording can take several minutes
)
with open("meeting.m4a", "rb") as audio:
result = client.audio.transcriptions.create(model="gemini-transcribe", file=audio, language="en")
print(result.text)
curl https://codex.photonmark.com/openai/v1/models \
-H "Authorization: Bearer $PHOTONMARK_PAY_TOKEN"
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PHOTONMARK_PAY_TOKEN,
baseURL: "https://codex.photonmark.com/openai/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-6-luna",
messages: [{ role: "user", content: "Reply with OK only." }],
});
console.log(resp.choices[0].message.content);
POST /images/generations and POST /images/editsare supported. Image variations and other Image API endpoints are not currently available.image_gen tool are separate capabilities. This API does not inject a missing native tool into a Codex session, but scripts, CLIs, MCP servers, and plugins can call it.If you need to migrate an existing OpenAI SDK app to the PhotonMark Codex API, contact us first with use case, model, concurrency, expected token volume, and whether web search / image generation is needed. We evaluate account by account.