Curl Examples
Online API Test
If you only want to confirm your key, start with a small local request from your terminal before configuring a full app.
Curl Command Reference
The following are curl examples for each API.
GPT and Codex
responses endpoint
curl https://api.fhrouter.com/v1/responses \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_FHROUTER_API_KEY' \
-d '{
"model": "gpt-5.5",
"input": [
{
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "Hello"
}
]
}
],
"stream": true
}'Note
The authentication header supports both Authorization and x-api-key; choose either one.
chat/completions endpoint
curl https://api.fhrouter.com/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_FHROUTER_API_KEY' \
-d '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"stream": true
}'Note
The /v1/chat/completions response is converted from /v1/responses, so some apps or plugins may behave differently. The responses endpoint is the better default when your client supports it.
Claude
curl https://api.fhrouter.com/v1/messages \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_FHROUTER_API_KEY' \
-H 'anthropic-version: 2023-06-01' \
-d '{
"model": "claude-opus-4-7",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Hello"
}
]
}
],
"max_tokens": 1024,
"stream": true
}'Note
The authentication header supports both Authorization and x-api-key; choose either one.
Gemini
curl --location 'https://api.fhrouter.com/v1beta/models/gemini-3.1-pro-preview:streamGenerateContent?alt=sse' \
--header 'connection: keep-alive' \
--header 'x-goog-api-key: YOUR_FHROUTER_API_KEY' \
--header 'content-type: application/json' \
--data '{
"generationConfig": {
"temperature": 1
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hello"
}
]
}
]
}'Common reminders
- Claude clients should use the Anthropic-style path and headers.
- GPT and Codex clients should usually use
/v1. - Gemini-native clients should use
/v1beta. - Start with a short prompt before sending a large coding task.
