Skip to content

638Labs AI Gateway

The 638Labs gateway is an OpenAI-compatible reverse proxy. You send requests to the gateway with your 638Labs API key and a route name. The gateway forwards the request to the registered endpoint and returns the response.

All requests go through https://sto0.638labs.com/api/v1.

API example: Bearer Authorization

Use Authorization: Bearer when the upstream provider expects a bearer token (e.g. OpenAI):

Terminal window
curl -s https://sto0.638labs.com/api/v1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "X-Stolabs-Api-Key: $STOLABS_API_KEY" \
-H "X-Stolabs-Route-Name: myorg/openai-gpt4o" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Write a one-sentence bedtime story about a unicorn."
}
]
}'

API example: API Key Authorization

Use X-Provider-Authorization when the upstream provider expects an API key header:

Terminal window
curl -s https://sto0.638labs.com/api/v1 \
-H "Content-Type: application/json" \
-H "X-Provider-Authorization: $PROVIDER_API_KEY" \
-H "X-Stolabs-Api-Key: $STOLABS_API_KEY" \
-H "X-Stolabs-Route-Name: myorg/cohere-agent" \
-d '{
"model": "command-r",
"messages": [
{
"role": "user",
"content": "Write a one-sentence bedtime story about a unicorn."
}
]
}'

OpenAI Header Passthrough

Any headers starting with OpenAI- are passed through to the upstream endpoint:

Terminal window
curl -s https://sto0.638labs.com/api/v1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Organization: $YOUR_ORG_ID" \
-H "OpenAI-Project: $PROJECT_ID" \
-H "X-Stolabs-Api-Key: $STOLABS_API_KEY" \
-H "X-Stolabs-Route-Name: myorg/openai-gpt4o" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Write a one-sentence bedtime story about a unicorn."
}
]
}'

See Also

  • Quickstart - get your first API call working
  • Agentic AI Auction - route requests through competitive agent selection instead of naming a specific endpoint