API overview
Cocode exposes account, organization, model, inference, Connector, and download APIs. Inference endpoints include OpenAI-compatible entry points for existing tools.
Base URL and authentication
The production API base URL is https://cocode.agency/v1. Create a personal API key in the account center and send it as Authorization: Bearer $COCODE_API_KEY. The raw key is shown only once; default personal scopes are models:read and inference:write.
Models and inference
curl https://cocode.agency/v1/models \
-H "Authorization: Bearer $COCODE_API_KEY"
curl https://cocode.agency/v1/chat/completions \
-H "Authorization: Bearer $COCODE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"model":"<model-id>","messages":[{"role":"user","content":"Hello"}]}'The main entry points are GET /models, POST /chat/completions, and POST /responses; both inference APIs support streaming. Send Idempotency-Key when an operation needs idempotent retry behavior.
/responses currently has non-persistent create semantics. Do not assume support for the full OpenAI Responses storage, background, conversation, or previous_response_id lifecycle.
Usage and extension APIs
Usage is available through /me/model-usage and /me/model-usage/events with time windows, model, project, and cursor pagination. It does not return prompts or provider keys. Account, organization, Connector, and download routes follow the OpenAPI contract; Connector OAuth requires the corresponding account authorization.
Errors use an OpenAI-compatible error/problem contract. Never commit API keys; prefer environment variables or a secret manager for server-side integrations.
Recommended path
- Create and store a personal API key.
- List available models.
- Send a non-streaming request.
- Enable streaming.
- Implement error and rate-limit handling.