Use Codex-style OpenAI clients with Gab AI through /v1/chat/completions and /v1/responses.
Codex-style clients generally expect OpenAI-compatible environment variables. Use the Gab AI OpenAI-compatible base URL:
Newer OpenAI agent clients may use /v1/responses instead of /v1/chat/completions. Gab AI supports both paths for text, streaming, and function/tool workflows.
Test the Responses API directly before launching your CLI: To test function calling:
export OPENAI_BASE_URL="https://gab.ai/v1"
export OPENAI_API_KEY="YOUR_GAB_API_KEY"
codex
Newer OpenAI agent clients may use /v1/responses instead of /v1/chat/completions. Gab AI supports both paths for text, streaming, and function/tool workflows.
curl https://gab.ai/v1/responses \\
-H "Authorization: Bearer YOUR_GAB_API_KEY" \\
-H "Content-Type: application/json" \\
-d '{
"model": "arya",
"input": "Say hello from the Responses API.",
"max_output_tokens": 128
}'
curl https://gab.ai/v1/responses \\
-H "Authorization: Bearer YOUR_GAB_API_KEY" \\
-H "Content-Type: application/json" \\
-d '{
"model": "arya",
"input": "What is the weather in Paris? Use the weather tool.",
"tools": [
{
"type": "function",
"name": "get_weather",
"description": "Get weather for a location.",
"parameters": {
"type": "object",
"properties": { "location": { "type": "string" } },
"required": ["location"]
}
}
],
"tool_choice": { "type": "function", "name": "get_weather" }
}'