Inference quickstart
Choose a model, make a direct inference request, and read its response
Make your first text-generation request with an Inworld API key and a model ID. You can call a model directly without creating a router.
Choose a model
Browse inworld.ai/models and select Text. Choose a model and copy its API model ID. The example below uses openai/gpt-5.4.
For other outputs, start with Image generation, Video generation or Decisions.
Set your API key
Create a Standard API key in Inworld Portal and copy the complete Base64 credential. Set it as-is; do not encode it again:
export INWORLD_API_KEY="<your Base64 API key>"Run these examples on your server. Browser and mobile clients should use a backend-minted token or a server proxy. See authentication recovery if a request fails.
Send a request
curl --request POST \
--url https://api.inworld.ai/v1/chat/completions \
--header "Authorization: Basic $INWORLD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "openai/gpt-5.4",
"messages": [
{"role": "user", "content": "Write a 50-word bio for a software engineer."}
]
}'To use another text model, replace model with its API model ID. The request follows OpenAI's Chat Completions format; see OpenAI compatibility for SDK setup.
Read the response
Read the generated text from choices[0].message.content. The response also includes the model that answered and token usage. Here is an abbreviated example; the generated text and token counts will vary:
{
"model": "openai/gpt-5.4",
"choices": [
{
"message": {
"role": "assistant",
"content": "A software engineer who builds reliable applications..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 50,
"total_tokens": 68
}
}Next steps
- Chat completions: streaming, tool calling, structured outputs and other text-model capabilities.
- Image generation: generate an image, save it, and guide the next result with a reference.
- Video generation: create a job, poll its status and download the video.
- Decisions: get typed answers that your application can act on.
- Request-level routing: add model or provider preferences and fallbacks to a request.
Create a reusable router
For traffic splitting, conditional routes or saved routing configurations, follow the Routing quickstart. Creating a router through the API requires Router Write permission; calling a model directly does not.